I was wondering if someone could please show me how to do this assignment which I am having trouble figuring out. And possibly explain it as well.
Thanks a bunch
Write a shell script call groupname that does the following:
- Insert a reference to the Bourne shell as the command interpreter of this shell script.
- Add the appropriate comments
- 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.
- The argument entered on the command line is your account name (ie firstnamelastname)
- Using the command line arguement search the password file for a match.
- Using the line that matched, get the 4th field and search the /etc/group file for a match.
- Display the only the group name to standard out.
- 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 swiersma
will output to standout staff
==========
$ groupname
Usage: groupname account_name
=========
$ groupname swiersma jsmith
Usage: groupname account_name
what part exactly you need
what part exactly you need help in?
Ahmed D. El-Mekkawy