Previous Section  < Day Day Up >  Next Section

LAB 13: GETTING USER INPUT

  1. Write a script called nosy that will do the following:

    1. Ask the user's full name––first, last, and middle name.

    2. Greet the user by his or her first name.

    3. Ask the user's year of birth and calculate his or her age (use expr).

    4. Ask the user's login name and print his or her user ID (from /etc/passwd).

    5. Tell the user his or her home directory.

    6. Show the user the processes he or she is running.

    7. Tell the user the day of the week, and the current time in nonmilitary time. The output should resemble

      
      The day of the week is Tuesday and the current time is 04:07:38 PM.
      
      

  2. Create a text file called datafile (unless this file has already been provided for you). Each entry consists of fields separated by colons. The fields are as follows:

    1. First and last name

    2. Phone number

    3. Address

    4. Birth date

    5. Salary

  3. Create a script called lookup that will do the following:

    1. Contain a comment section with the script name, your name, the date, and the reason for writing this script. The reason for writing this script is to display the datafile in sorted order.

    2. Sort datafile by last names.

    3. Show the user the contents of datafile.

    4. Tell the user the number of entries in the file.

  4. Try the –x and –v options for debugging your script. How did you use these commands? How do they differ?

    Previous Section  < Day Day Up >  Next Section