-
Write, test and submit a bash shell script called script1 that
prints out its command line arguments (not the command name), one per line.
Test runs of the program should look like this:
$
$ script1
$ script1 a b hello
a
b
hello
$
-
Write, test and submit a bash shell script called script2 that
behaves like script1 except that it outputs its commandline arguments
in sorted order. Test runs of the program should look like this:
$
$ script2
$ script2 hello goodbye zzz aa
aa
goodbye
hello
zzz
$
-
Write, test and submit a bash shell script called script3 that
outputs its commandline arguments, along with the argument number, exactly
as shown in the following examples:
$
$ script3
$ script3 Hello
arg number 1 is Hello
$ script3 Hello Goodbye c b a
arg number 1 is Hello
arg number 2 is Goodbye
arg number 3 is c
arg number 4 is b
arg number 5 is a
$
-
Write, test and submit a bash shell script called script4.
script4 should print out, one per line, the "real names" of all users
with an account on the system whose login names begin with the script's
first commandline argument. If there is not exactly 1 commandline argument,
then a usage message (exactly like that in the examples) should be written
to standard error (not standard out). See the following examples.
In particular, see the error message when the wrong number of commandline args
is used when the full pathname of the command is given or the name of the command
has been changed (so you can't just hardcode 'script4' into your error message).
$
$ script4
Usage: script4 <logname or logname prefix> <-- written to standard error
$ script4 ali bil
Usage: script4 <logname or logname prefix> <-- written to standard error
$ /cs/dept/www/course/2031/script4 firstArg secondArg
Usage: script4 <logname or logname prefix> <-- written to standard error
$ mv script4 fourthScript
$ /cs/dept/www/course/2031/fourthScript firstArg secondArg
Usage: fourthScript <logname or logname prefix> <-- written to standard error
$ mv fourthScript script4
$ ./script4 a b c
Usage: script4 <logname or logname prefix> <-- written to standard error
$ script4 ali
Ali Mahmoodi
alireza moghaddam
$ script4 al
Albert Rothenstein
alborz Workstation
Alexander Andreopoulos
Ali Mahmoodi
alireza moghaddam
Robert S Allison
$ script4 bi
bin
Vassilios Tzerpos
Bill Andreopoulos
Bill Kapralos
Bita Banihashemi
$