42sh is a bash-styled shell project completely written from scratch in C with very limited access to libraries and tools.
- Learn a lot more about the inner workings of the UNIX system.
- Learn about the different type of shell implementations.
- Learn what a lexer is and how to write it.
- Learn what a parser is and how to write it.
- Learn how to write nice and clean code.
- Learn how process execution work.
- Learn some porsix features.
- To create a stable and complete UNIX shell.
- Error monitoring without using
errno
. - Prompt display.
- Complete management of input.
- (Multiline) line edition.
- Redirection with the following operators:
>
>>
<
<<
>&
<&
- Control operators:
|
||
&&
;
&
- Quoting managment
"
,'
, and\
or inhibitors. - Basic parameter expansion and additional parameter formats:
- Word expansion performs by POSIX
~
${parameter:-word}
${parameter:=word}
${parameter:?word}
${parameter:+word}
${#parameter}
${parameter%}
${parameter%%}
${parameter#}
${parameter##}
- Command history:
!!
!word
!number
!-number
- Saving to a file so that it can be used over several sessions
- Built-in fc (all POSIX options)
- Incremental search in the history with CTRL-R
- Autocomplete.
- Builtins:
echo
cd
env
export
setenv
unsetenv
exit
type
- Pattern matching (globing):
*
,?
,[]
,!
and the caracters intervals with\
(backslash). - Control or command substitution:
$()
. - Alias management via built-ins
alias
andunalias
. - A hash table and built-in
hash
to interact with it. - Monitoring of intern shell variables.
- Job control monitoring, with buitl-ins
jobs
,fg
,bg
and the&
operator.
Install:
git clone https://github.com/Tsorion9/42sh.git
make && make clean
Run:
./42sh