Minishell is a simple shell implementation inspired by bash, created as part of the 42 school core curriculum. This project focuses on process management, pipes, file descriptors, and command interpretation, allowing users to execute commands with the same behavior as a standard shell.
- Custom command prompt
- Command history navigation
- Command execution using PATH variable or relative/absolute paths
- Signal handling
- The command line gets parsed and tokenized into an abstract syntax tree
- Proper handling of single and double quotes
- Environment variable expansion
- Exit status variable expansion (
$?
)
- Output redirection (
>
) - Append output redirection (
>>
) - Input redirection (
<
) - Heredoc (
<<
): Read input until a specified delimiter
- Command pipeline support (
|
): Connect output of one command to input of another
echo
with-n
optioncd
without optionspwd
without optionsexport
without optionsunset
without optionsexit
without optionsenv
without options or arguments
- Logical operators
&&
and||
- Support for both interactive and non-interactive shell
- Unclosed quotes handling: Allows continuation of input over multiple lines until quotes are closed (like bash)
This project requires the GNU Readline library to handle command line input and history.
sudo apt-get install libreadline-dev
brew install readline
sudo pacman -S readline
git clone https://github.com/yourusername/minishell.git
cd minishell
make
./minishell
echo "ls -la" | ./minishell
./minishell < commands.txt