LAB 57: CONDITIONAL STATEMENTS

 <  Day Day Up  >  

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

    1. Take a command-line argument, a user 's login name .

    2. Test to see if a command-line argument was provided.

    3. Check to see if the user is in the /etc/passwd file. If so, will print

       Found <user> in the /etc/passwd file. 

      Otherwise, will print

       No such user on our system. 

  2. In the lookup script from Lab 56, ask the user if he or she would like to add an entry to datafile . If the answer is yes or y :

    1. Prompt the user for a new name, phone number, address, birth date, and salary. Each item will be stored in a separate variable. You will provide the colons between the fields and append the information to the datafile .

    2. Sort the file by last names . Tell the user you added the entry, and show him or her the line preceded by the line number.

 <  Day Day Up  >  


UNIX Shells by Example
UNIX Shells by Example (4th Edition)
ISBN: 013147572X
EAN: 2147483647
Year: 2004
Pages: 454
Authors: Ellie Quigley

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net