2016-10-28 15:44:13 +00:00
|
|
|
If you use more than 3 lines of code from the internet, cite them in a comment.
|
|
|
|
It's cause for an 'f' otherwise!!!!
|
|
|
|
|
|
|
|
|
|
|
|
THIS IS OUT OF 20 POINTS!!!! No one can get more than 20 points.
|
|
|
|
|
|
|
|
If you work in pairs, then I'll give each person 2/3 of the total points. So
|
|
|
|
if a team gets 30 (and each person gets 15), I'll give each student 20.
|
|
|
|
|
|
|
|
|
|
|
|
If you work in threes, then I'll give each person 1/2 of the total points. So
|
|
|
|
if a team gets 40 (and each person gets 13.3333), I'll give each student 20.
|
|
|
|
|
|
|
|
|
|
|
|
The Shell Assignment (total 42 points)
|
2016-11-02 01:44:25 +00:00
|
|
|
+ 1 ~~Can run an executable~~
|
2016-10-31 00:21:39 +00:00
|
|
|
+ `/bin/ls`
|
2016-11-02 01:44:25 +00:00
|
|
|
+ 1 ~~You search the path for the executable~~
|
2016-10-31 00:21:39 +00:00
|
|
|
+ `ls`
|
2016-11-07 21:40:57 +00:00
|
|
|
+ 1 ~~Can do file input redirection "<"~~
|
2016-10-31 00:21:39 +00:00
|
|
|
+ `ls > fred`
|
2016-11-07 21:40:57 +00:00
|
|
|
+ 1 ~~Can do file output redirection ">"~~
|
2016-10-31 00:21:39 +00:00
|
|
|
+ `ls < fred`
|
|
|
|
+ 2 Can do command piping "|"
|
|
|
|
+ `ls | wc`
|
|
|
|
+ 1 Can do lots of pipes
|
|
|
|
+ `ls | grep fred | wc`
|
2016-11-07 21:40:57 +00:00
|
|
|
+ 1 ~~Can do at least one combination of these things~~
|
2016-10-31 00:21:39 +00:00
|
|
|
+ `ls | wc > fred`
|
|
|
|
+ 4 Can do any combination of three of <, >, and |
|
|
|
|
+ `cat < filename | sort > sortedFile.txt`
|
|
|
|
+ 2 Can set enviornment variables
|
|
|
|
+ `PATH=:/bin:/sbin:/usr/sbin:/usr/bin`
|
|
|
|
+ 2 Expands enviornment variables on the command line
|
|
|
|
+ `ls $HOME`
|
|
|
|
+ 2 Does filename expansion "glob" (Hint: Use the built in glob.)
|
|
|
|
+ `ls a*b`
|
2016-11-02 01:44:25 +00:00
|
|
|
+ 1 ~~Knows how to change directory~~
|
2016-10-31 00:21:39 +00:00
|
|
|
+ `cd /fred`
|
2016-11-10 17:49:06 +00:00
|
|
|
+ 1 ~~Bang last command~~
|
2016-10-31 00:21:39 +00:00
|
|
|
+ `!l` runs ls
|
|
|
|
+ 1 Bang # command
|
|
|
|
+ `!4` runs 4th command from history
|
2016-11-10 17:49:06 +00:00
|
|
|
+ 1 ~~Queue commands~~
|
2016-10-31 00:21:39 +00:00
|
|
|
+ `make ; make install`
|
2016-11-10 17:49:06 +00:00
|
|
|
+ 1 ~~Can have lots of semicolons~~
|
2016-10-31 00:21:39 +00:00
|
|
|
+ `ls; sleep 3; rm fred`
|
|
|
|
+ 2 Change Prompt
|
|
|
|
+ `PS1="what is you command?"`
|
|
|
|
+ 3 Can run commands in the background.
|
|
|
|
+ `processImage &`
|
|
|
|
+ 1 Concatenate commands with &. Only runs next command if the previous
|
2016-10-28 15:44:13 +00:00
|
|
|
comand returned success.
|
2016-10-31 00:21:39 +00:00
|
|
|
+ `cd /home/rappleto & rm fred.txt`
|
2016-11-10 22:07:47 +00:00
|
|
|
+ 1 ~~Catch Keyboard interrupt~~
|
2016-10-31 00:21:39 +00:00
|
|
|
+ `ctrl + c` = back to prompt
|
|
|
|
+ 1 Replace "~" with the home directory
|
|
|
|
+ `rm ~/junkfile`
|
2016-11-02 01:44:25 +00:00
|
|
|
+ 1 ~~Control-L clears the screen~~
|
2016-10-31 00:21:39 +00:00
|
|
|
+ `ctrl-l` = clear screen
|
|
|
|
+ 3 When they misspell a command, offer a suggestion
|
|
|
|
+ (user) `lss`
|
|
|
|
+ (shell) Did you mean `ls`?
|
|
|
|
+ 2 Can run commands from a file
|
|
|
|
+ `. scriptFile.txt`
|
2016-11-07 21:40:57 +00:00
|
|
|
+ 2 ~~Tab Completion~~ and ~~Arrow History~~
|
|
|
|
+ 1 ~~Saves and reloads history to a file~~
|
2016-10-31 00:21:39 +00:00
|
|
|
+ 2 Automatically runs a file called .myshell when it starts
|
|
|
|
+ 2 Only runs execuatables from an approved list
|
|
|
|
+ -2 Commands cannot have arguments (i.e. ls -l does not work).
|
2016-10-28 15:44:13 +00:00
|
|
|
|
2016-11-10 22:07:47 +00:00
|
|
|
14 pts
|
2016-11-10 17:49:06 +00:00
|
|
|
/20
|
2016-10-28 15:44:13 +00:00
|
|
|
|
|
|
|
Some cases to consider
|
2016-10-31 00:21:39 +00:00
|
|
|
+ A person tries to run a non-executable.
|
2016-11-07 21:40:57 +00:00
|
|
|
+ A person tries to read or write to a non-existent file.
|
2016-10-31 00:21:39 +00:00
|
|
|
+ A person tries to read or write to a file they do not have permissions on.
|
|
|
|
+ A person tries a non-sensical command. (i.e. `ls > foo > fee < doo < dee`)
|
|
|
|
+ A person tries to pipe to a non-command (i.e. `ls | /tmp/foo.txt`)
|
|
|
|
+ A person tries to pipe from a non-command (i.e. `/tmp/foo | ls`)
|
|
|
|
+ A person tries to expand a non-variable (i.e. `ls $DOES_NOT_EXIST`)
|
|
|
|
+ A regular expression matches no files.
|
|
|
|
+ A regular expression matches one file.
|
|
|
|
+ A regular expression matches lots of files.
|
|
|
|
+ A person tries to change directory to something that does not exist.
|
2016-10-28 15:44:13 +00:00
|
|
|
|
|
|
|
These programs are due Friday before finals week. It will take a totally excellent excuse to move this at all.
|