Previous Section  < Day Day Up >  Next Section

LAB 29: COMMAND-LINE ARGUMENTS

  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.
      
      

    Previous Section  < Day Day Up >  Next Section