minishell
is a minimalist UNIX shell created from scratch as part of the 42 school curriculum.
It replicates core features of common shells like bash/zsh, including command execution, environment handling, redirections, pipelines, and more.
Our processing pipeline: input → validator → parser → expander → executor
-
Input
User input is read usingreadline()
with history support. -
Validator
Checks for unmatched quotes, syntax errors, or invalid sequences. -
Parser
Turns the raw input into a structured format usingt_command
andt_arg
. -
Expander
Processes:- Environment variables (
$VAR
) - Wildcards (
*
) - Quotes removal and expansion rules
- Environment variables (
-
Executor
Executes built-ins directly or forks for external commands.
Handles redirections, heredocs, and pipes.
These are implemented internally (no fork
):
echo
cd
pwd
export
unset
exit
|
— pipe&&
— AND (execute next only if previous succeeded)||
— OR (execute next only if previous failed)
>
— redirect output (overwrite)>>
— redirect output (append)<
— redirect input<<
— heredoc
make
./minishell