Minishell is a 42 school project that recreates a simplified Unix shell in C.
Minishell is a command-line shell written in C that mimics key Bash-like behavior.
It handles parsing, execution, redirections, pipes, environment variables, and built-in commands.
- Prompt display and command history.
- Parsing of commands, quotes, pipes, and redirections.
- Environment variable expansion, including
$?. - Built-in commands:
echocdpwdexportunsetenvexit
- Execution of external commands using the system
PATH. - Input/output redirections.
- Heredoc support.
- Signal handling for interactive shell behavior.
Key learning objectives:
- Lexical analysis and parsing
- Process creation and
execve - File descriptor manipulation
- Signal handling (
SIGINT,SIGQUIT) - Memory management without leaks
make./minishell$ ./minishell
minishell$ echo "Hello World"
Hello World
minishell$ echo $?
0
minishell$ ls -la | grep Makefile | wc -l
1
minishell$ cat << EOF > test.txt
> line1
> line2
> EOF
minishell$ cat test.txt
line1
line2
minishell$ exitCtrl+C(SIGINT) → sends SIGINT to active processCtrl+D→ exit shell
This project focuses on process management, file descriptors, signal handling, and shell behavior.
Its behavior is designed to stay close to bash where required by the project rules.