Minishell is an operating system shell, providing a complete command line interface for the system. REPL-based command interpreter features lexical parsing, command tokenization, and execution. Written in C programming language from scratch with a self implemented C library (libft) using Unix system calls. Handled core process management using Unix system calls (fork, exec, wait), enabling execution of both builtin and external programs.
- Pipeline execution (|)
- I/O redirections (>, <, >>)
- Multi-process command chaining
- Environment variable expansion and
- Runtime modification of shell state
- Builtin shell commands (e.g., cd, exit, export)
Code was formatted in compliance with the Norm.
This is a highly unconventional format and does not reflect our own preference.
Some key rules of the format:
- All source files must have the "42 header".
- Strict 80 column limit for all lines.
- Functions have a strict 25 line limit.
- Variables must be declared at the top of the functions (like C89 style).
- Functions can define at most 5 variables.
- No empty lines allowed inside the function body except right after the variable declaration.
- No comments allowed inside the function body.
- Functions can have at most 4 parameters.
- Maximum of 5 functions per file.
Redirections
Input
<Basic input
cat < file.txtNon-existent file
cat < does_not_exist.txtInput + args
wc -l < file.txt
Output
>Basic overwrite
echo hello > out.txt cat out.txtOverwrite existing file
echo first > out.txt echo second > out.txt cat out.txtCommand + output
ls > out.txt
Append
>>Basic append
echo a >> out.txt echo b >> out.txt cat out.txtMix overwrite + append
echo start > out.txt echo middle >> out.txt echo end >> out.txt cat out.txt
Heredoc
<<Basic heredoc
cat << EOF hello world EOFEmpty heredoc
cat << EOF EOFMultiple lines
cat << STOP one two three STOP
Edge / bug-detection tests
No space cases
echo hi>file.txt cat<file.txtMultiple redirections
echo hello > a.txt > b.txtMixed input/output
wc -l < file.txt > out.txt