Skip to content

Building a simplified version of bash, encompassing functionalities such as handling signals, environment variables, redirections, pipes, and implementing a custom parser.

fkoolhoven/Minishell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo

Creating a simple version of Bash.

About the project

A project made in accordance with the Minishell project which is part of the Codam Core Curriculum. This project was a collaboration between Felicia Koolhoven and Jagna Hendriks. We created our own simple version of bash, Jagna handling the executer, environment and signals and Felicia handling the tokenizer, expander and parser. Our Minishell contains several builtins, handles redirections (including heredocs), pipes, several signals. It expands environment variables (or attempts to) when it finds a $ but distinguishes between single (') and double (") quotes, not interpreting $ when it is between double quotes. This was the biggest collaborative project we had both worked on until that point.

Getting started

Start by cloning the repository:

git clone https://github.com/fkoolhoven/Minishell

Go into the minishell directory and compile by using make:

make

Minishell has the GNU Readline library as a dependency. You may need to configure the Makefile for your particular machine/OS.

Usage

logo

You can use Minishell like you would use Bash.

For example:

<< EOF grep "Hello world" | wc > outfile 

will work the same as in Bash. Minishell handles <<, <, >, >> as redirections and | as pipe.

Minishell also has several builtins (see src/builtins) so

export var="Hello world"

will add var to the environment variables.

And because we also handle $, single and double quotes

echo "$USER" '$USER'

will output: [yourusername] $USER

Available signals:

  • ctrl-C displays a new prompt on a new line
  • ctrl-D exits the shell
  • ctrl-\ does nothing

Minishell also has a working history (use the arrow keys).

Important learnings

We worked together for several weeks on this project and got a lot of practice in with things we were already familiar with + we were introduced to some new topics.

  1. Working together on a complex project, deciding on a stategy together and communicating about challenges
  2. Using Git and GitHub in a collaborative way
  3. Implementing our own hash table to store the environment variables
  4. Writing an elaborate tokenizer / parser that interprets user input in a way that can be used by an executer
  5. Preventing memory leaks in a large project
  6. Implementing signals
  7. Parent and child processes
  8. Linked lists
  9. File descriptors
  10. Exit codes and handling errors

Contact

See our profile pages for ways to contact us!

About

Building a simplified version of bash, encompassing functionalities such as handling signals, environment variables, redirections, pipes, and implementing a custom parser.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published