Hive Helsinki (School 42) 9th curriculum project (Rank03)
The repository contains a custom shell, replicating the behavioiur of the bash command line shell. It is the first project in the school 42 curriculum conducted in a team consisting of 2 students. Thus, apart from learning in-depth about the characteristics of the bash language, the logic and setup of a command line shell and how to structure and develop a complex program written in C (consisting of extensive parsing/lexing, command execution of both built-in and external commands and comprehensive signal handling), the setup of a joint git repository and agreement on a suitable and efficient working mode is another pivotal aspect of this project.
The implementation orients closely on a bash shell, the following functionalities are within scope:
- assigns tokens to user input based on bash syntax
- sets up and populates process structs containing e.g. command and redirections arrays, file descriptors and heredoc content
- handles single
'
and double quotes"
- handles environmental variable expansion via
$
character - handles
$?
for displaying exit status of most recently executed foreground pipeline
builtins:
echo
with option -ncd
with only a relative or absolute pathpwd
with no optionsexport
with no optionsunset
with no optionsenv
with no options or argumentsexit
with no options
pipes:
- the shell supports chaining builtins and external commands by
|
operator up to an arbitrary amount of 255 pipes.
redirections:
- handles the following redirections:
<, >, <<, >>
signals:
ctrl + d
ctrl + c
ctrl + \
The following functionalities are out of scope:
unclosed quotes
, whildcards *
, &&
, ||
, \
, ;
-gcc
compiler
with <readline.h>
To compile the minishell, clone the repository, cd into the folder and run:
$ make
Run the executable with the following command:
$ ./minishell
You are now in the minishell environment and can conduct the respective bash commands.
To delete all files generated with make, run:
$ make fclean
This library has been tested with [minishell_tester] (https://github.com/LucasKuhn/minishell_tester)