Skip to content

Latest commit

 

History

History
91 lines (71 loc) · 4.57 KB

README.md

File metadata and controls

91 lines (71 loc) · 4.57 KB

minishell (42Porto - 42Cursus)

Project done in collaboration with Rodrigo Ramos

Demonstration

Description

Basic shell that replicates core functionalities of bash.

Features

  • 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 and exit

Grade: 101/100

Installing and running the project

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

Makefile available targets

make or make all - compiles minishell
make clean - wipes all object files
make fclean - deletes minishell and all object files
make re - fclean + all

Useful links

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?

Disclaimer

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]