Assignment 3

Due: February 26 th
20 points

Your first Unix shell script!! Name your code as3Code (you will create your code using the Linux editor nano). Your script/program is to show me both the command and the output of the command to answer each of the 10 items below.

Under the Unix operating system, create a shell script (as3Code)that consists of Unix commands that answer the following:

  1. Display(i.e. echo) your first and last name
  2. Set the variable X to be your userid using the built-in variable
  3. echo the value of x with a message that says, "My login id is ..."
  4. Show the number of words in ONLY the hidden files in your home directory
  5. Show the permissions and details of all of the files (including hidden) in your home directory
  6. The current date
  7. Display the contents of the PATH variable
  8. Set the variable, var to your last name
  9. Display the value of the variable var
  10. Search (use the find command) through /usr and all of its subdirectories for files the begin with "dir" and end with ".h"

Since this is your first shell script, let me detail the actions that you should do:

  1. Use nano to create the file as3Code
  2. On the first line of as3Code, place the following:
    #!/bin/sh
  3. Exit nano
  4. Change permissions on as3Code to be executable
    chmod u+x as3Code
  5. Determine the Linux command to answer the first question
  6. After you find each answer, add two lines to your Unix shell script (i.e., program) - the first to echo the answer and the second to execute the command.
    For example, if I determined the answer was: ls -la
    I would add the following two lines to as3Code:
    echo "ls -la"
    ls -la
  7. Make sure you test your code!!!
    Exit nano and run your code by typing in:
    ./as3Code
  8. Continue this process until you have all 10 answers
To turn this assignment in: