The absurdly stupid shell
Minimal shell written in C as a hobby project.
- Fork and execute commands
-
cd
with builtin or by typing a folder name - Piping
- Multiple statements terminated by
;
- Conditional execution with
&&
and||
- History (as builtin)
- Comments
- Script files (including stdin)
- Variables
- Some keybinds (requires raw mode + rework of input code)
Nessie depends on nothing but the tools required to build it – make
and a C compiler – and some regular Linux syscalls.
Running the tests requires bats
and/or clang
.
Producing the man page requires pandoc
– this is only done in the make install
target.
Run make install
or make install-local
. Alternatively, simply run make
and put the binary wherever you want.
You should now be able to execute nessie
as a regular command, or run the binary with ./nessie
.
Run integration tests with make test
or fuzzer tests with make fuzz
.
Start an interactive session by simply running nessie
.
If you are stuck, try running help
, man nessie
or man <some other command>
.
Run a single command with nessie -c "some command"
.
Execute a script file with nessie script.sh
. One can also pipe or otherwise redirect a list of commands to nessie
, like echo "some command" | nessie
.
See the manual page for a more thorough explanation of Nessie's functionality.
Nessie's grammar is pretty minimal for the time being.
LINE := STATEMENT [; STATEMENT]* [# COMMENT]
STATEMENT := COMMAND
| COMMAND && STATEMENT
| COMMAND || STATEMENT
COMMAND := PROG [ARG]* [| COMMAND]*
PROG, ARG := TOKEN
| "TOKEN [TOKEN]*"
| 'WORD [WORD]*'
TOKEN := VARIABLE
| WORD
VARIABLE := $[A-Za-z0-9]+
WORD := <just continuous text>
COMMENT := <any text following a #>
- Linux manual pages for various C functions
- The C Programming Language by Brian W. Kernighan and Dennis M. Ritchie
- This stackoverflow answer to a question about piping in C