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 hello
immediately prints hello, sincesleep 1
runs in the background
- commmand lists
;
echo hello ; sleep 1 ; echo world
prints hello, waits one second, and prints world
- conditionals
&&
and||
true && echo true
prints truefalse && echo false
does not print falsetrue || echo true
prints nothingfalse || echo false
prints false
- pipelines
|
echo Bad | grep -c B
prints 1
- redirections
>
,<
, and2>
grep sleep < check.pl
outputs all lines containingsleep
in thecheck.pl
file
File | Description |
---|---|
helpers.c |
helper functions (e.g., parser) |
sh61.c |
shell implementation |
sh61.h |
token definitions |