CS 214: Systems Programming
Professor Menendez
Long Tran (netID: lht21)
Julian Herman (netID: jbh113)
- 'make' (default) will run debug mode
- 'make run' will run on official mode
- Our shell allows user to use as many piping commands as they wish
- Allow user to traverse to HOME directory using
~
*** Notice ***
- Testcases are created based on iLab machine's file system.
- Please use iLab machines to test these cases for accurate result
-
Built-in Programs:
- pwd:
- Single command: output into current STDOUT_FILENO (redirection will set STDOUT_FILENO before executing)
- Pipeline command: output into pipeline
- cd: Do not have input/output
- pwd:
-
Exectuting Programs:
- Assure to be able to run programs in these directories:
- /usr/local/sbin
/usr/local/sbin/showstats.sh
- /usr/local/bin
/usr/local/bin/eclipse
- /usr/sbin
/usr/sbin/zic
- /usr/bin
/usr/bin/ls
- /sbin
/sbin/zic
- /bin
/bin/pwd
- Assure to be able to run programs in these directories:
-
Program with arguments: (argument test for built-in cd)
-
Being able to recognize the argument list for the progam
cd ..echo hello
cd .. hello world-> ERRORecho hello worldcat filename1 filename2
echo hello world this is a very very long sentence and it aims to have infinite length
-
Being able to identify argument list for each command in pipeline. 7.
echo shell should recognize this sentence as argument list | wc8.ls -l | grep "file"-> expected SUCCESS: -l is argument of ls, "file" is argument of grep -
Redirections: - Redirection token is recognized without space -
echo hello world>echo.txt-wc<filename1-wc<filename1>wc.txt-> Expected wc counts words in filename1 and write to wc.txt - Redirection token and its input/output token can be placed anywhere in command line. -echo hello this is a > echo.txt sentence from echo.-echo > echo.txt this is a sentence.-echo this is a sentence > echo.txt -
Pipes (Multiple pipes): - Pipes still work even though second command doesn't use input from first command -
echo hello world | ls-
Pipes still work even though first command write nothing, and second command use input from pipe
cd .. | wc
-
Two Pipes
ls -l | grep "file" | wcls -l | grep "e" | awk '{print $9}' | wc
-
-
Home Directory
- the user can include
~/at anypoint in their commands and it will be replaced with their home directory~/command1 < input | command2 > outputcommand1 < ~/input | ~/command2 > output
- the user can include
-
Wildcards
- the user can include wildcards anywhere in a command (even if the token is a path, in which case, the token will be replaced by everything matching the wildcard in said path)
-
command1 < foo*bar star | ~/command2 > output-command1 < command2 jar | car foo*bar > output- wildcards can be combined with home dir symbol
~/~/command1 < foo*bar star | ~/command2 > output
- wildcards can be combined with home dir symbol
- the user can include wildcards anywhere in a command (even if the token is a path, in which case, the token will be replaced by everything matching the wildcard in said path)
-
-
-
Errors Detected:
- lone redirections and lone pipes
>|
- no token after redirection or after / before pipe
echo >echo <echo || echo
- adjacent pipe and redirection tokens
echo <<echo >>echo >|echo |<
- Multiple redirections: uses last one found
echo >echo1.txt >echo2.txtuses >echo2.txtwc <filename1 <filename2uses <filename2wc <filename1 >wc.txt <filename2wc <filename1 >wc.txt >wc2.txt