Could someone help me by midnight tonight!!!
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:
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 jsmith
will output to standout
staff
==========
$ groupname
Usage: groupname account_name
=========
$ groupname jdoe jsmith
Usage: groupname account_name
2. Relevant commands, code, scripts, algorithms:
can't use awk or print
3. The attempts at a solution (include all code and scripts):
This is what I have so far...I don't know how to put this one together
#!/bin/sh
# bourne shell to find groupname for a user
script=suffix
argc=1
if [ $# -ne "$argc" ]
then
echo "Usage: $script groupname account_name"
4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
St Clair College - Windsor Ontario
Phil Aylesworth MIT 516 Linux II - St. Clair College - Canada's Southernmost and Hottest College
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).