Skip to content

dhaliti/MiniShell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MiniShell

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.

Prerequisite

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

Getting started

To run MiniShell, simply clone this repository and run the make command to build the program. Then simply run the executable:

make && ./minishell

Features

  • 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.

Contributors

Project realised with Jérémy Perras

Ressources

Bash manual
POSIX shell specification
GNU C Library mannual
Linux man pages

Licence

MiniShell is released under the MIT License.

forthebadge