A simplified Unix shell implementation, developed as part of the 42 School curriculum.
Minishell is a project that aims to create a functional shell, inspired by Bash, with built-in command support, redirections, pipelines, variable expansions, and signal handling. It’s a great exercise in process management, parsing, memory allocation, and system calls in a POSIX environment.
- Prompt loop with input reading.
- Execution of commands with full path or via
$PATH. - Built-in commands:
echo,cd,pwd,export,unset,env,exit. - Redirections:
>,<,>>,<<(heredoc). - Pipelines:
ls | grep .c | wc -l. - Environment variable expansion:
$HOME,$?, etc. - Quote handling:
'and"following POSIX rules. - Signal handling (
Ctrl-C,Ctrl-\, etc.).
./minishellA prompt (minishell$) will appear. You can now use built-in or system commands.
Examples:
minishell$ echo Hello World
minishell$ export PATH=/bin:/usr/bin
minishell$ ls -l | grep minishell > output.txt
minishell$ cat << EOF
> hello
> EOF- Tokenizes the user input and builds a command structure.
- Supports syntax error checking and quote balancing.
- Expands environment variables,
$?, and handles double quotes correctly.
- Manages child processes, file descriptors, pipes, and built-in execution without forking.
- Implements a heredoc manager and redirection handlers.
- Restores terminal behaviors and handles
SIGINT,SIGQUITgracefully. - Prevents crashes and zombie processes.
🧑🎓 Tharushan – utharushan 🧑🎓 El Bachir – ebella