Skip to content

Official development project of minishell at 42 lisbon

Notifications You must be signed in to change notification settings

Rafael2sf/minishell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MINISHELL

@42 lisbon Coauthored by: https://github.com/daalmeid

📝 - Description

This project brings together all the knowledge acquired in previous projects and more, by rebuilding one of the core features of any modern pc, a shell, based on i/o methodology, you will be able to run builtins and programs in the terminal using environment variables as well.

📓 - Implementation

1) User input

  The shell stays in a waiting mode, using the readline library, managing the terminal buffer and history.

2) Lexer / Tokenizing

  After receiving the input and making some basic checks, the input line is splitted into tokens, in the format of a binary tree, also known as Abstract syntax tree, in this way we can manage the diferent tokens based on their type in a generalized way.

3) Parser

  Once the tree is built with all the tokens, we iterate it to make all the necessary changes, such as removing unwanted and special characters, ex: spaces, tabs, quotes... And expanding the variables to their value.

4) Executor

  Now that the input is ready to be used, we can pump it into the executor, all the command line will be exeuted at the same time, builtins functions will be run in the main process, and binaries will be executed in child processes using execve and pipes. Once it's complete, all the unecessary memory is freed and go back to step 1.

Note: This project makes use of termios structure and signal handling to manage some of the behavior.

alt text alt text

ℹ️ - Usage

Compiles under macOS and linux, requires readline library

git clone https://github.com/Rafael2sf/minishell.git minishell

🔨 - Build

cd minishell; make

About

Official development project of minishell at 42 lisbon

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published