Here are the things we will look to grade against for shell programming:
Defensive coding: you should always assume that the user will enter incorrect input. So how are you going to deal with it? Tips: make sure you check the number of parameters entered against what you expect. Inform the user using ”Usage: incorrect number of parameters: enter two dates e.g., 05/15/1959 05/20/1970” then exist with suitable exit value. If your program uses other shell commands say date and a user gives an incorrect date then the date command will inform the output (that makes sense) but you should look at the return status ($?) to make sure it is 0 (which is completed correctly). If not your code should exit the program with a suitable error.
Exit gracefully: Spy should catch signals and remove any temporary files and exit the daemon gracefully. Discussed this in class.
Here is a more detailed rubric:
Correctness 80%
– Is the program correct (i.e., does it work) and error free?
All shell programs equally graded – I know spy is hardest.
birthday.sh
– Argument Check -3
– Exit with error is a command fails (e.g., date) -3
– Wrong output on birthday-5
– Format Check -3
– Functionally incorrect -50
– Cannot run it -100
leap_year.sh
– Argument Check -3
– Exit with error is a command fails -3
– Wrong leap year decision algorithm -20
– Closest leap year calculation -10
– Functionally incorrect -50
– Cannot run it -100
count_linesinfiles.sh
– Argument Check -3
– Individual file line count -10
– Total file line count -10
– Exit with error is a command fails -5
– Fail test in recursive directory -10
– Functionally incorrect -50
– Cannot run it -100
wget_search.sh
– Argument Check -3
– Failure file download -10
– Wrong keyword count -10
– Exit with error is a command fails -5
– Wrong format -2
– Functionally incorrect -50
– Cannot run it -100
spy.sh
– Did not pass 6-10pm test -20
– Only log-on time or only log-in time is right -10
– Send email in a incorrect manner no subject, incorrect format -5
– Cannot handle edge cases -5
– Did not use functions - 10
– Exit gracefully and remove any log files, correct exit values -5
– Functionally incorrect -50
– Cannot run it -100
Extra credit for spy.sh (5%)
Clarity (10%)
– Is the code easy to read, well commented, use good names
– for variables and functions. In essence, is it easy to understand and use
– [K&P] Clarity makes sure that the code is easy to understand for people
– and machines.
– Too much mysterious variable names with comments -3
Simplicity (10%)
– Is the code as simple as possible.– [K&P] Simplicity keeps the program short and manageable