theozanchi / 42_Berlin_minishell

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Minishell logo

Grade badge Language Badge Norminette BadgeLibrary Badge

Minitalk

This project is about creating our own Shell with basic functions. It is a group project done with Jakob Schott

The full subject can be found here.

Downloading and compiling the project

Clone the library and use make to compile

git clone https://github.com/theozanchi/42_Berlin_minishell/tree/main
cd 42_Berlin_minishell
make

Compilation screenshot

Running the program

The program is launched without any argument and can be used like any other shell:

Minishell prompt

Supported features

  • Functioning work history, saved under the home folder of the user (.minishell_history)
  • Piped commands |
  • Redirections <, >, << and >>
  • Signals SIGINT and SIGQUIT (same behaviour as bash)
  • Some commands are implememted as built-in commands:
    • echo with option -n
    • cd with only a relative or absolute path
    • pwd with no options
    • export with no options
    • unset with no options
    • env with no options or arguments
    • exit with no options

Some examples

Example 1 Example 2 Example 3

Structure of the code

  1. sources/1_lexer: tokenizes the user input (collected through readline) and performs a first lexical analysis
  2. sources/2_parser: loads the user input into the main data structure and aggregates it as a char**
  3. sources/3_executer: creates pipes and child processes to execute the command. Built-ins are executed in the main process whereas other commands are executed in a dedicated child process

About


Languages

Language:C 95.7%Language:Makefile 4.3%