/minishell

A miniature clone of bash. Handles running commands, redirections, pipes, environment variables, signals and command history just like in bash.

Primary LanguageCApache License 2.0Apache-2.0

minishell

minishell As beautiful as a shell

🧐 Description:

A miniature clone of bash.

🎲 Features:

  • minishell can run executables from an absolute /bin/ls, relative ../../../../../bin/ls, or environment PATH ls with arguments.
  • Environment variables are also handled including the return code $?.
  • You can use redirections > >> < << and pipes |.
  • Builtins: cd, pwd, echo, export, unset, env, exit.
  • Single and double quotes work just like in bash, but not for multiline commands.
  • Three signals are also handled just like in bash:
    • Ctrl-C interrupts a running process or brings up a new prompt.
    • Ctrl-\ quits from a running program and does nothing on the prompt.
    • Ctrl-D throws an EOF or exits minishell.

🔧 Usage:

  1. Go into the root directory and run make.
cd minishell
make
  1. Run the executable created in the output folder.
cd output
./minishell

Screen Shot 2021-10-07 at 12 41 16 PM

✅ Credit

minishell was a two person project done with yabdelgh

I was responsible for reading input, the lexer, parser, environment variables, signal handling and command history.

While yabdelgh took care of command execution, pipes, redirections and signal handling inside child processes.