Skip to content

minishell is a custom shell implementation that replicates core bash features, including command history, path resolution, redirections, pipes, environment variables, signal handling, and built-in commands like echo, cd, and env. It offers a comprehensive shell experience for understanding Unix-like shell internals.

Notifications You must be signed in to change notification settings

cmunoz-g/minishell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

minishell

Welcome to our minishell! This project was completed by cmunoz-g and jjuanramos.

For the deepest context about the project, we recommend reading maiadegraaf's README: it is explained so incredibly well we thought it's redundant to re-do it.

tl;dr

Still, If you want to dive straight in, the summary is that this project aims to recreate a mini version of bash.

The requirements are:

  • Have a functional history of all previous commands.
  • Run the right executable based on PATH or relative and absolute paths.
  • Implement redirections such as <, >, «, and ».
  • Implement pipes (|).
  • Handle environment variables.
  • Handle $?.
  • Handle signals such as ctrl-C, ctrl-D, and ctrl-.
  • Implement the built-ins: echo, cd, pwd, export, unset, env, and exit (except echo and cd, all of them without arguments).
  • Make sure there are no leaks.

Installation

In order to execute minishell, you will need gcc installed. You'll probably have it installed by default, otherwise, we recommend you head to GNU's website and install it.

With that out of the way, the steps needed to execute minishell are:

  1. Cloning the repo: git clone [email protected]:cmunoz-g/minishell.git
  2. cd minishell
  3. make
  4. ./minishell

That should be it! It's been tested on Linux and MacOs.

Commands to try

Get creative! Some examples are:

  • cat | cat | cat | echo << end
  • ls -la | wc -c >> out.txt
  • cat < out.txt
  • echo $PATH >> out.txt
  • export a=HELLO
  • echo $HELLO
  • echo '$HELLO'

And more! The heuristic is that, as long as the commands fit the requirements, they should behave as bash.

About

minishell is a custom shell implementation that replicates core bash features, including command history, path resolution, redirections, pipes, environment variables, signal handling, and built-in commands like echo, cd, and env. It offers a comprehensive shell experience for understanding Unix-like shell internals.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published