42sh was a team project made at EPITA in which we had to implement a POSIX shell from scratch using pure C. No memory leaks were allowed and we needed to implement by ourselves most of useful C functions. Our 42sh do not use standard builtins so we had to create the famous ones like echo, source, continue, break, exit, export...
Authors: Bilot Tristan | Delfau Nora | Salemi Enzar | Thambithurai Madushan
- POSIX compliant
- no memory leaks
- no warnings/errors
- tested on ArchLinux, Ubuntu, MacOS
1. ./build.sh
2. mkdir build && cd build && cmake . && make
3. cmake . && make
1. ./build/42sh
2. ./42sh (only if built with the #3 way)
1. ./build.sh doc (this will build/rebuild the 42sh before)
2. cd build && make doc (if the shell is already built)
3. ./documentation.sh (if the shell is already built)
4. make doc (if shell built with the 3rd way)
-- evince doc/latex/refman.pdf
-- cd doc/man/man3 && man ./[SOURCE FILE NAME].3
-- firefox doc/html/index.html
1. ./build.sh check (this will build/rebuild the 42sh before)
2. cd build && make check (if the shell is already built)
3. make check (if shell built with the 3rd way)
1. ./clean.sh
2. cd build && make clean
3. make clean
echo $(ls -la && pwd)
echo $((2*33/2-2))
echo $((!3&&1 || 3))
echo $((~2- ~3 + ~1&& ~4/4-1))
./42sh 2>/dev/null >/dev/null
tree . | ./42sh >> file
cat< test_suite.py
var=$(echo 42); echo $var
echo $RANDOM${UID}
alias ll="ls -l"; ll; unalias ll
export PWD="/bin"; export
for i in a b c d e; do echo "Hello, world !"; done
for i in {0..42}; do echo "current: $i"; done
while ! echo a | echo b | echo c; do echo toto; done
until echo a | echo b | echo c; do echo toto; done
if cat README; then echo success; elif ls; then echo success; else echo failed; fi
if echo toto; then echo success; else echo failed; fi
case a in b | c | d ) hello & ;; esac
( a || ( ( b && c; ) || ls\n ); )
Key | Signal |
---|---|
Ctrl+C Ctrl+Z Ctrl+L |
Kill current process Suspend curent process Clear shell |
Tab |
Autocompletion |
^ v |
Browse history |
< > |
Browse current command |