About • Features • Installation • Usage
Minishell is a collaborative project from 42 Lisboa that involves creating a simple, yet functional, Unix shell. This project is a deep dive into process creation, synchronization, and input/output management, reinforcing core systems programming concepts.
The shell handles command execution, environment variables, signals, and built-in commands, providing a hands-on understanding of how tools like Bash or Zsh work under the hood.
Key Learning Objectives:
- Process creation and management using
fork(),execve(), andwaitpid(). - Input parsing, tokenization, and handling of quoting and escaping.
- Redirections (
>,>>,<,<<) and pipes (|). - Signal handling (e.g.,
Ctrl-C,Ctrl-D,Ctrl-\). - Environment variable expansion (
$VAR).
| Category | Implemented Features |
|---|---|
| Command Execution | Executes commands found in the PATH (e.g., ls, grep, cat). |
| Built-ins | echo, cd, pwd, export, unset, env, exit. |
| Redirections | Input (<), Output (>), Append (>>), Heredoc (<<). |
| Pipes | Multiple pipes in a single command line (e.g., ls │ grep .c │ cat -e). |
| Variables | Expands $USER and $? (exit status of the last command). |
| Quotes & Escapes | Handles single quotes ' ', double quotes " ", and the backslash \. |
| Signals | Ctrl-C displays a new prompt, Ctrl-D exits the shell, Ctrl-\ does nothing. |
- Clone the repository
git clone https://github.com/duarteagostinho/minishell.git cd minishell - Compile the program
This will generate the
make
minishellexecutable.
Run the shell by executing the generated binary:
./minishell