This is shell61, a shell I built as part of a class. I wrote everything on sh61.c (i.e., the shell implementation) and sh61.h (i.e., token definitions)
make sh61 builds the shell's executable sh61
make check runs tests
After building the sh61 executable by running make sh61, execute it and play around with some of the commands below.
echo,sleep,grep,wc,sort,cat,true,false, etc.- background command
&sleep 1 & echo helloimmediately prints hello, sincesleep 1runs in the background
- commmand lists
;echo hello ; sleep 1 ; echo worldprints hello, waits one second, and prints world
- conditionals
&&and||true && echo trueprints truefalse && echo falsedoes not print falsetrue || echo trueprints nothingfalse || echo falseprints false
- pipelines
|echo Bad | grep -c Bprints 1
- redirections
>,<, and2>grep sleep < check.ploutputs all lines containingsleepin thecheck.plfile
| File | Description |
|---|---|
helpers.c |
helper functions (e.g., parser) |
sh61.c |
shell implementation |
sh61.h |
token definitions |