LAB 55: COMMAND-LINE ARGUMENTS

 <  Day Day Up  >  

  1. Write a script called rename that will take two arguments: the first argument is the name of the original file and the second argument is the new name for the file.

    If the user does not provide two arguments, a usage message will appear on the screen and the script will exit. Here is an example of how the script works:

     $  rename   Usage: rename oldfilename newfilename  $ $  rename file1 file2   file1 has been renamed file2   Here is a listing of the directory:   a file2   b file.bak  

  2. The following find command (SunOS) will list all files in the root partition that are larger than 100K and that have been modified in the last week. (Check your man pages for the correct find syntax on your system.)

      find / xdev mtime 7 size +200 print  

  3. Write a script called bigfiles that will take two arguments: one will be the mtime and one the size value. An appropriate error message will be sent to stderr if the user does not provide two arguments.

  4. If you have time, write a script called vib that creates backup files for vi . The backup files will have the extension .bak appended to the original name.

 <  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