This minimal shell runs in an infinite loop, displaying a prompt (->) to the user as a signal to input a command line.
It then parses the command, tokening it into arguments ready for execution.
Should the user input nothing or any string of characters that doesn't match a known command, our shell will behave similarly to the standard shell, printing error messages or prompting again as appropriate.
- Edition was made on VS code.
- We put a lot of effort to built a beautiful and fonctional README.
- To have a nice, readable and easily understandable code we followed the Betty coding style.
- To serve this purpose we separated as much as possible the different functions on different files
- We used system calls only when needed.
- We fought the memory leaks with honor and tenacity, and although suffering huge losses on this battlefield, we won in the very end.
- FYI : We wanted to add a nice and unique personnality to our shell but unfortunately all of our strength was focused on defeating our enemy, Sir Valgrind the Ruthless.
The man page can be invoked with the following command:
man ./hsh_manA picture is worth a thousand words (at least, we hope so).

| File name | Description |
|---|---|
| .gitignore | File containing all the tests and executable files |
| _gentenv.c | Function to get the value of the passed environment variable |
| AUTHORS | File containing information about the project contributors |
| checkarg.c | Function that analyzes the first argument passed to the program |
| get_path.c | Finds the directory in which the passed command has been found |
| hsh_man | Manual page of hsh |
| main.c | Main function (program entry point) |
| pr_env.c | Function that prints the environment variables to stdout |
| README.md | Project description and usage information |
| simple_shell.h | Header file containing all used functions and libraries |
| spoon.c | Function that launches a fork process |
Compile using following command :
gcc -Wall -Werror -Wextra -pedantic -std=gnu89 *.c -o hshThese ensured we would catch all possible issues and that our shell would have good portability.
Simply invoke it with ./hsh, wait for the welcome message and prompt to show (it won't take long, we promise!) then type in your commands.
Note that it works both interactively and not, like so:
User@Ubuntu:/$ ./hsh
Hi there!
-> ls
AUTHORS _getenv.c checkarg.c get_path.c hsh images main.c pr_env.c simple_shell.h spoon.c
-> exit
See you next time!
User@Ubuntu:/$ echo "/bin/ls" | ./hsh
AUTHORS _getenv.c checkarg.c get_path.c hsh images main.c pr_env.c simple_shell.h spoon.c
This simple shell takes into account two built-ins: exit and env. Typing exit will close the shell, and env will print the contents of the environment variable.
It can also be used for basic commands sur as ls, cp, rm, or pwd, the latter being both a built-in and a binary command.
Here are some of them in action:
As shown, there is no need to input the path to the desired commands' location, as PATH is handled.
- The
cdcommand has not been implemented at this date.
Your most obliged and humble servants:
Priam Demailly
Sarah Wacquiez