Linux Assignment Urgent Help
These three activities are three little shell programs to create and review, one called svi.sh and the other uon.sh, the other is the command_menu program at the bottom of page 456. Your job is to explain what certain lines of the shell program do. The last part of this lab is to create the command_menu program. On the first two programs add your comments about what those lines of the code do after the # symbol, describing briefly what that particular piece of code will do in the program.
These are the three files to submit in the same dropbox. Type them in vi, and replace the ???? with your comments explaining what those lines do in the program. The last command_menu program you will need to create it and run it a few times, make sure to change the ie. “a) date” with other commands or options just to try it out and make it different than the book.
name@domain:~> cat svi.sh
# name / date ?????????????????
# purpose of the program ????????????????
if test $# = 1 # ???
if test -f $1 # ??? << the lines that starts with # or in this case after the command #??? bash ignores them, the # except $# that is a command.
cp $1 $HOME/keep #??? <<< your job is to replace the ??? with your comment indicating what that lines does in the program
echo " file not found.Try again"
echo " You must specify a file name.Try again."
For the first two comment lines, your name and date
# Your Name
The lines that contain #... are comments to the program, Replace the ??? with your comments explaining what happens in that line of the program. Submit the program with your name using the following command:
name@domain:~> cat uon.sh
#uon.sh: this program will ????????
until who | grep "$1" > /dev/null #??????????
do sleep 30 #??????????
echo "$1 is logged on." exit 0
Create the program on page 456 4th edition called command_menu. Run it a few times, change options, etc.
$ cat command_menu
# menu interface to simple commands
echo -e "\n" COMMAND MENU\n"
echo " a. Current date and time"
echo " b. Users currently logged in"
echo " c. Name of the working directory"
echo - e " d. Contents of the working directory\n"
echo -n "Enter a, b, c, or d: "