Getting Started (Chap 5)

Assignment 4

  1. Create a script file called nf that contains instructions to count the number of files in the current directory. You can check your answers here.
  2. What command do you use to make this file executable?
  3. What directory should you put the file in?
  4. Add a comment at the begining of the file with your name and the date
  5. Add some text to the output to describe the number. i.e. "Files in the current directory:"
  6. Modify the script so that it includes the absolute pathname of the directory. This is stored in the variable called PWD.
  7. Store your first name in a variable and then display it with a meaningful message.
  8. Add a comment on the same line as you set the variable.
  9. At the command prompt or in a script file, create two variables with numbers stored in them. Calculate the product (multiplication) of these and display it.
  10. Assign the value of this product to another variable then display that new variable.