In this lab you will practice with simple command substitution and a simple argument. It is somewhat similar to your first lab - but gives information about a particular user instead of just about "me".

Complete this assignment on hills. Use a shell script to complete your homework. Makes sure that your resulting .sh file is readable.

Experiment with variables and executing commands. Your uploaded file should be named outputs a few pieces of information about a user's account. It takes a single argument - the login of the user about whom you want information. When it starts, it must ensure that it is given a single argument. If not, it must abort with a message (use one of the variable operators for this as you did in Lab2, or use an if statement). If the argument is valid, here is what your script does:

Sample Output:

$ ./ joe
Information about the user "joe" follows:
Home directory is "/users/joe"
Shell is "/usr/bin/ksh"
Real name is "Joe Blow"

$ ./ joe1
./ line 5: user: no such user

$ ./
./ line 2: user: need a single argument

Additional TidBits

The passwd file contains 7 fields delimited by colons. The fifth field may have subfields delimited by commas. This field is used by the program finger, and, hence, is called the finger information field (or, by the old name, the GECOS field). The first comma-separated field here is the user's real name. To see how this works, examine the passwd entry for me, gboyd, on hills. To enter your own real name (which could be your name or a title), run the program chfn on hills.

Turning In Your Assignment

To submit your work, upload a copy of your file to Canvas. Any analysis of your script should be copied and pasted into the Lab 3 Textbox