Bash shell scripts

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

  1. The problem statement, all variables and given/known data:
  1. Test that exactly one command line argrument is enter from the command line. If not, display the usage message and stop the script and set the status to 1. If exactly one is entered, continue processing.
  2. The argument entered on the command line is your account name (ie firstnamelastname)
  3. Using the command line arguement search the password file for a match.
  4. Using the line that matched, get the 4th field and search the /etc/group file for a match.
  5. Display the only the group name to standard out.
  6. Cut and Paste you program in the space below also with a session of you executing your program with the examples provided.

For Example,
$ groupname john smith

will output to standout staff

$ groupname
Usage: groupname account_name

$ groupname jsmith
Usage: groupname account_name

  1. Relevant commands, code, scripts, algorithms:

  2. The attempts at a solution (include all code and scripts):

if [ $# -ne 5 ]
then
echo usage groupname username
exit 1
fi
~

  1. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

please read the last lines (in red)!