Previous Section  < Day Day Up >  Next Section

LAB 28: 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 the user's age.

    4. Ask the user's login name and print the user's 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 following:

    
    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 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 echo and verbose commands for debugging your script. How did you use these commands?

    Previous Section  < Day Day Up >  Next Section