A custom Unix shell implementation with basic functionality inspired by bash
Minishell is a Unix shell implementation that recreates essential functionalities of a command-line interpreter. This project focuses on parsing command syntax, implementing built-in commands, managing processes, and handling signals. It's developed as part of the 42 school curriculum to deepen understanding of process creation and control.
- ✅ Command line parsing with support for quotes, double quotes, tilde and '*' wildcard
- ✅ Command execution with PATH variable resolution
- ✅ Built-in commands: echo, cd, pwd, export, unset, env, exit
- ✅ Environment variable expansion
- ✅ Signal handling (Ctrl+C, Ctrl+D, Ctrl+\)
- ✅ Redirections (input, output, append) and pipes
- ✅ Error handling with appropriate error messages and return values
- ✅ Command history using readline library
- Clone the repository:
git clone https://github.com/ondbeh/minishell.git
- Navigate to the project directory:
cd minishell
- Compile the project:
make
- GCC compiler
- Make
- Readline library
For Debian/Ubuntu:
sudo apt-get install libreadline-dev
For macOS:
brew install readline
Run the shell:
./minishell
Feature | Description |
---|---|
Commands | Execute commands found in $PATH |
Quotes | Handle single ' and double " quotes |
Redirections | < (input), > (output), >> (append), << (heredoc) |
Pipes | | to pipe from first command STD_OUT to second command STD_IN |
Logical Operators | && (and), || (or) to chain commands |
Parenthesis | ( and ) to determine command priority |
Wildcards | * for pattern matching in current working directory |
Variables | $VAR environment variable expansion |
Exit status | $? for last command's exit status |
Signals | Ctrl+C, Ctrl+D, Ctrl+\ handling |
This project is licensed under the MIT License - see the license file for details.