Assignment 6 100 pts
Your last assignment #7 will be a shell script similar to this week's
assignment. The difference is that you will need to implement several
protection features and much more detail on the menu options that will be
used on this assignment.
Control structures, loops and a menu system is part of any high level
programming language. It allows the program to branch out to different parts
depending on a logical decisions. Remember that binary systems have only one
outcome (true (1) or false (0))
You will develop a shell script with the case command selecting the
following unix commands. Please look at your book (page 444). The script command_menu. Your
job will be to implement similar program but have a total of 10 commands,
plus the *) catch all.
 |
This program will have a menu with 10 commands. Use the commands from
the menu below (the implementation is similar to the command_menu script
on page 444).
|
 |
Your menu will be surrounded by a loop, either the until or while
loop, so that when one option is concluded it will go back to the main
menu until the user selects an option x to exit. Try NOT TO USE THE
EXIT command to quit the script, use the proper logic of the loop
control to exit the program. Also using while : or while true or until
true, etc. is not a good loop logic. You have a menu so, the exit should
be an option in the menu such as, when option <> q, etc.
|
 |
Your first option will be an emailer program. This emailer program
will be the automated process of what we had done: mail -s
"......" (The whole program should be in one file, do not call different
sections of the the program by using ~/emailer.sh for instance. It will
not work for me since I will not have this file called emailer.sh when
you submit me the assignment. So, enter the whole program in one file)
|
 |
THIS TIME Email this assignment to wmorales on
the linux system since I will have to run your script. Use the command
mail -s "cs140U online - Your Name - Assignment 6" wmorales <
menu_script.sh
|
 |
Place a copy in the assignment dropbox. Before uploading the script
menu_script.sh, make a backup copy, rename it in the linux and call it
menu_script.sh.txt, convert it to DOS format using the command unix2dos,
then transfer it to your computer using psftp or filezilla, then upload
it. Do the same for assignment #7.
|
 | Make sure to use proper documentation (comments) on your program and
ask questions if you are in doubt about what need to be accomplished and
use the discussion board. |
 | A comment block such as those on the examples seen in the
lecture must be on top of your script file with your name, date,
description of the program. Make sure to document your program with
comments in the various areas of your program. |
 |
Use proper Program
Style
|
 |
Menu example:
|
Assignment 6 explained (You will need quicktime to play this video)
Assignment 6 video explanation
Some items to check where points may be deducted, the same will apply for
#7 with additional items to be checked as required in the assignment
instructions.
=============
1) Lack of comments on your program
2) Use of meaningful variable names
3) #!/bin/bash should be the first line of our program.
4) Using the option read -n1 varname allows you to tap on �one key to
continue�
5) Many commands might produce a full screen of output and you will not
be able to see the what was on the top, always | more
6) Use the command clear to clear the screen and have a non-cluttered
output. =======================
7) Use the logic of the loop to get out of the loop, using exit 1 or exit
0 still terminates the program but you are forcing the end of the program
instead of using the logic of a loop
8) There are many ways to implement the until loop, but you need to make
sure to use the proper operator and initialize the variable before it is
checked in the until loop. Otherwise the comparison condition may always be
true or false. Same not as above, use the logic of the loop to end it.
9) Consider using functions. They will be easier to troubleshoot if your
program does not work and it organizes your program
10) Initialize your variables to a value.
11) Test you emailer.
12) Binary logic. Remember that when you do binary logic you are always
comparing two items. For instance if a > b then .. you do not use if
a > b > c, you need to break it down into if a > b and a > c