LAB 29: COMMAND-LINE ARGUMENTS

 <  Day Day Up  >  

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

    1. Take two filenames as command-line arguments; the first file is the old file and the second file is the new one.

    2. Rename the old filename with the new filename.

    3. List the files in the directory to show the change.

  2. 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, print the following:

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

      Otherwise, print the following:

       No such user on our system. 

 <  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