## The Shell

The minishell project is part of the common core curriculum at ecole42 and is seen as a milestone and one of the biggest jumps in complexity on the way to completing the cursus.

The rules are simple: Create a program that will replicate basic shell behaviour like typically found on posix systems.

Some of the requirements are:

- Command line parsing
- I/O loop to accept continuous commands
- Command execution
- File Descriptor redirection
- Pipe Operators
- Environment Variables
- Builtin functions (cd, export, exit etc.)
- Heredoc
- Logical AND ( && )
- Logical OR ( || )
- and more...

The program has to be written in C, we are working on GNU/Linux machines.

We are also required to follow a very strict norm on which you can read more here.

What makes the 42 projects stand out in my opinon is that the tools we use are very restricted, essentially only allowing syscalls to interface with the kernel, some utility functions and memory functions, and in this case we were allowed to use printf, which is normally forbidden. This means that all utilty has to be implemented by hand, and all relevant code will be written by the projects authors.

We also could use the readline function used in bash to handle the input of the user.
Since memory leaks of any kind are considered an unrecoverable mistake when validating a project, and the readline function would inevitably leak memory, those leaks were explicitly tolerated by the projects requirements.

But, out of cursiousity, we decided to recreate the readline function, removing the dependecy and leaks from our project, and leanring a lot along the way.
In my opinion, this is one of the more interesting part of our implementation, and I very much enjoyed it!

This project was a team effort, and big thanks go out to my team partner
and good friend, Andrej Arama!

The source code for the project can be seen on my git server and I have also provided a live version of the shell found below.
Please keep in mind, this is barely a prototype, and serves more as a proof of concept, than a fully implemented shell.

Credits and many thanks to ttyd for providing the web integeration!
Have fun!

After trying out the shell, feel free to check out my other projects!

Next Project...