A 42 School project to create a simplified UNIX command-line interpreter
Inspired by bash, written in C with ❤️
- Interactive prompt with working command history (using GNU readline)
- Command execution via PATH or absolute/relative paths
- Advanced parsing with single quotes
'
, double quotes"
, and environment variables ($VAR
) - Redirections:
- Input
<
and output>
redirection - Heredoc
<<
delimiter support - Append mode
>>
- Input
- Pipes (
|
) for multi-command chaining - Signal handling for Ctrl-C, Ctrl-D, and Ctrl-\ (bash-like behavior)
- Builtins:
echo
with-n
optioncd
,pwd
,exit
export
,unset
,env
for environment management
- Logical operators
&&
and||
with parentheses - Wildcard expansion
*
for current directory - Enhanced error handling and edge case management
- Clone repository:
git clone https://github.com/<your-username>/minishell.git cd minishell
make
./minishell
Requires GNU readline library (install via package manager if needed)
$> ./minishell
minishell> ls -l | grep .c | wc -l
42
minishell> echo "Hello $USER" > greeting.txt
minishell> cat << EOF > output.txt
heredoc> Multiline
heredoc> input
heredoc> EOF
Language: C (C99 standard)
Memory: Zero-leaks policy with careful allocation/free management
Architecture: Modular design with separate parsing/execution logic
Compliance: Follows 42 School Norm (strict code style guidelines)
Dependencies: Uses readline for line editing and history features
Precise handling of quoting and expansion rules
File descriptor management for complex redirections
Process synchronization in pipes
Signal handling in interactive/non-interactive modes
Environment variable management
Not a full POSIX-compliant shell
Limited built-in commands compared to bash
No tilde expansion or advanced globbing
Pull requests welcome! Please follow:
42 School Norm guidelines
Test thoroughly
Document changes
MIT License - See LICENSE for details
"The best way to predict the future is to implement it." - Inspired by Alan Kay