Project done in collaboration with Rodrigo Ramos
Basic shell that replicates core functionalities of bash.
- Handle command execution from relative, absolute and paths taken from
PATH
; - Handle
$?
; - Handle SIGINT and SIGQUIT signals;
- Environment variables;
- Command history;
- Quotes (both single and double) support;
- I/O Redirections support;
- Pipe support;
- Builtin commands:
echo
,cd
,pwd
,export
,unset
,env
andexit
1- Install dependencies:
sudo apt-get install make libreadline-dev
2- Clone this repository:
git clone https://github.com/Kuninoto/42_minishell minishell
3- Navigate to the project's folder
cd minishell
4- Compile and wipe the object files that you won't need anymore
make && make clean
5- Run minishell
./minishell
make
or make all
- compiles minishell
make clean
- wipes all object files
make fclean
- deletes minishell
and all object files
make re
- fclean
+ all
Understanding Bash/Shell behavior and related functions:
Writing a UNIX shell part 1
Writing a UNIX shell part 2
Writing a UNIX shell part 3
GNU documentation about redirections
Shell Program Explained
Shell Code - More Detail
EnthusiastiCon - Stefanie Schirmer “OMG building a shell in 10 minutes”
execve()
Signals and traps in UNIX
UNIX signals and traps
List of terminal generated signals (eg Ctrl-C -> SIGINT)
What's a relative path?
What's an absolute path?
TERM environment variable (UNIX)
What is an environment variable?
TERM environment variable not set
Writing your own shell
Tiny Shell - case study
Pipes, Forks, & Dups: Understanding Command Execution and Input/Output Data Flow
Open-source alike project
Parsing:
Parsing Explained
Parsing
Functional Parsing
Recursive Descent Parsing
Open-source alike project
Parsing reference
Abstract Syntax Tree (AST):
Abstract syntax tree on Wikipedia
How to construct an abstract syntax tree
What is an AST?
At 42School, almost every project must be written in accordance to the "Norm", the schools' coding standard. As a result, the implementation of certain parts may appear strange and for sure had room for improvement.
Made by Nuno Carvalho (Kuninoto) | [email protected]