MiniShell is a small and lightweight implementation of the popular Unix shell written in C. It features a number of built-in commands, including cd, env, and echo, as well as the ability to parse user input, execute external binaries, and handle pipes.
Readline is necessary to the project. Here is how to install it on your machine on macOS (assuming Homebrew is already installed):
brew install readline
brew link --force readline
echo 'export C_INCLUDE_PATH="/usr/local/opt/readline/include:$C_INCLUDE_PATH"' >> ~/.zshrc
echo 'export LIBRARY_PATH="/usr/local/opt/readline/lib:$LIBRARY_PATH"' >> ~/.zshrc
source ~/.zshrc
Note: Replace ~/.zshrc
with ~/.bashrc
if you use bash instead of zsh
To run MiniShell, simply clone this repository and run the make
command to build the program. Then simply run the executable:
make && ./minishell
- Built-in commands: MiniShell includes a number of built-in commands, including cd for changing the current working directory as well as env, export, and unset for displaying and modifying the environment variables.
- External command execution: just like a reak shell, MiniShell can execute binaries by searching the directories specified in the PATH environment variable.
- Input parsing: MiniShell can parse and interpret user input, including support for command arguments pipeline operators, redirections, and heredoc.
- Pipe handling: Mini Bash can connect the standard output of one command to the standard input of another using the | pipe operator.
Project realised with Jérémy Perras
Bash manual
POSIX shell specification
GNU C Library mannual
Linux man pages
MiniShell is released under the MIT License.