Complete this assignment on hills. Use a shell script to complete your homework. Makes sure that your resulting .sh file is readable. In order to start you off for this assignment, skeleton code has been provided here: /pub/cs/grwoo/cs160b/Lab2/cmdsub.sh. You can also download this file here. A grader should be able to run your shell script on the command line after viewing the contents.
cmdsub.sh takes a single line of text as an argument. You give it a line of text when you run it like this: cmdsub.sh "A sample line of text"
The starting file for cmdsub.sh has code to ensure it is run with an argument and to place the line of text in the variable LINE for you.
You will then add commands to cmdsub.sh to accomplish the following:
the line of text
the number of characters and the number of words in the line of text
the number of unique users (excluding yourself) that are logged onto hills
a random number less than 1000. (To see how to get the raw material for this, try echo ($RANDOM)
The skeleton code cmdsub.sh has lots of comments and hints to help you.
Finally, when you are satisfied with your cmdsub.sh script, see if you can explain and correctly predict the output of the following commands:
$ ./cmdsub.sh "Here is a line of text" The line of text is: "Here is a line of text" It has 22 characters and 6 words There are 14 users on hills right now Here is a random number less than 1000: 491
To submit your work, upload a copy of your cmdsub.sh file to Canvas. Any analysis of your script should be copied and pasted into the Lab 2 textbox