Assignment - basic shell program
Please read Shell Programming Fundamentals. Then write a simple shell script program named shellscript1 and deposit it in your "assignments" subdirectory.
Your shellscript1 program will perform the following:
and produce output with the following wording and layout:
|Date and Time: Mon May 7 16:00:28 PDT 2001
The number of words in the Gettysburg Address is: 268
Are you happy or sad? happy
You are happy.
If you don't know how to perform one of these actions, ask yourself what regular command could do it from the prompt. For example, clearing the screen from the script is equivalent to doing so from the prompt. So what command, at the prompt, would clear the screen? Once you have the command, just insert it into the script. (The command for clearing the screen is "clear," by the way.) In Shell Programming Fundamentals you saw wc -l used to count lines. Here you are asked to count just the words instead. wc can do that too. See the man page for wc to figure out how.
The Gettysburg Address was a famous, short speech given in 1863 by Abraham Lincoln on a Pennsylvania battlefield of the U.S. Civil War. A text file containing it is available on the remote unix machine. It is /home/public/gettysburg.txt. In your shellscript1 program, apply wc to that file to get the word count in the Address.
When finished, please put your shellscript1 file into your "assignments" directory under your home directory. It will be graded solely on whether it fulfills the output and behavior requirements above. In other words, I will not examine the code, only run the program and see if it does or does not do what it is supposed to do.