So im working on a lab for my unix class and im having some problems with this shell script we are supposed to do here is the question: Write a shell script that accepts a list of files(space delimited), and does the following 1)lists a long listing of the file
2) displays the number of lines in the file
3) displays the first 2 lines of the file
4) after listing all files, displays a friendly goodbye message.
separate the files with some dashes and make it easy to read.
heres my script:
#!/bin/bash
while [ "$1" != "" ]
do
ls -la$1
shift
wc
shift
head-n2
shift
echo goodbye
done
exit 3
now he gave an example in class thats like this:
#!/bin/bash
# This is a Comment Line
while [ "$1" != "" ]
do
ls -la $1
shift
done
exit 0
he said that this shell script is basically this but i had to add in the other commands besides the long listing. any help will be great. thanks
2) displays the number of lines in the file
3) displays the first 2 lines of the file
4) after listing all files, displays a friendly goodbye message.
separate the files with some dashes and make it easy to read.
heres my script:
#!/bin/bash
while [ "$1" != "" ]
do
ls -la$1
shift
wc
shift
head-n2
shift
echo goodbye
done
exit 3
now he gave an example in class thats like this:
#!/bin/bash
# This is a Comment Line
while [ "$1" != "" ]
do
ls -la $1
shift
done
exit 0
he said that this shell script is basically this but i had to add in the other commands besides the long listing. any help will be great. thanks
Comment