{"id":27373540,"url":"https://github.com/magalhaesm/minishell","last_synced_at":"2025-08-30T09:07:09.577Z","repository":{"id":62940609,"uuid":"557830107","full_name":"magalhaesm/minishell","owner":"magalhaesm","description":"This project is about creating a simple shell.","archived":false,"fork":false,"pushed_at":"2024-06-06T17:22:16.000Z","size":262,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-23T18:58:34.514Z","etag":null,"topics":["42saopaulo","42school","42sp","c","ecole42","makefile","minishell","minishell-42","minishell42"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/magalhaesm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-10-26T11:41:07.000Z","updated_at":"2024-06-06T17:22:16.000Z","dependencies_parsed_at":"2025-04-13T11:15:28.040Z","dependency_job_id":"d3af3183-eb2f-4314-8eb4-1dc684af85fd","html_url":"https://github.com/magalhaesm/minishell","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/magalhaesm/minishell","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magalhaesm%2Fminishell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magalhaesm%2Fminishell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magalhaesm%2Fminishell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magalhaesm%2Fminishell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magalhaesm","download_url":"https://codeload.github.com/magalhaesm/minishell/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magalhaesm%2Fminishell/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272827488,"owners_count":24999813,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["42saopaulo","42school","42sp","c","ecole42","makefile","minishell","minishell-42","minishell42"],"created_at":"2025-04-13T11:15:20.749Z","updated_at":"2025-08-30T09:07:09.551Z","avatar_url":"https://github.com/magalhaesm.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://user-images.githubusercontent.com/102881479/223723896-8bb0e61e-1102-4dd9-b29a-06c4725aa3eb.png\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/OS-Linux-blue\" alt=\"OS\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Language-C%20%7C%20C%2B%2B-blue.svg\" alt=\"Language\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Grade-125%2F100-brightgreen.svg\" alt=\"Grade\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Status-Completed-brightgreen.svg\" alt=\"Status\"\u003e\n\u003c/p\u003e\n\n## Introduction\n\nThe 8th project of 42 cursus syllabus asks students to implement a simplified shell. It's about minishell, as beautiful as a shell.\n\nAs the project's subject states, the existence of shells is linked to the very existence of IT. At the time, all developers agreed that _communicating with a computer using aligned 1/0 swiches was seriously irritating_. It was only logical that they came up with the idea of creating a software to communicate with a computer using interactive lines of commands in a language somewhat close to the human language.\n\n## How to compile and run the project\n\n#### 1) Copy this repository to your local workstation\n\n```html\ngit clone https://github.com/magalhaesm/minishell.git\n```\n\n#### 2) Install the required libraries to run the functions from readline library\n\n```html\nsudo apt-get install -y libreadline6 libreadline6-dev\n```\n\n#### 3) Compile the project with Makefile\n\n```html\nmake\n```\n\n#### 4) Launch the executable file\n\n```html\n./minishell\n```\n\nIf you want to run the executable program automatically with valgrind flags to check for leaks, just write `make checks` and press enter.\n\n## Implemented builtins\n\n| Builtin | Command description |\n|:------|:------|\n| `echo` with `-n` | Displays a line of text to the standard output |\n| `cd` | Changes the working directory of the current shell execution environment |\n| `pwd` | Prints the full filename of the current working directory |\n| `export name[=word]` | Sets the export attribute for variables |\n| `unset` | Unsets values and attributes of variables and functions |\n| `env` | Sets each name to value in the enviroment and run command |\n| `exit` | Causes the shell to exit with exit status specified |\n\n## About how we implemented the project\n\nThere are two main files at projects's root directory:\n\n- `include`: contains all the necessary headers for the project\n- `grammar`: the implemented grammar, which creates and checks the sentences\n- `libft`: our own C library with some helpful auxiliary functions, such as ft_strlen\n- `tests`: contains unit tests created with [Criterion](https://github.com/Snaipe/Criterion) testing framework to evaluate functions in `src`\n- `src`: contains the whole project implementation\n  - `builtins`: implements the required builtins by the project's subject\n  - `exec`: consists of functions that executes user's input\n  - `expansion`: implements shell expansors, such as quote marks and wildcards\n  - `helpers`: contains utils function used on the project as a whole\n  - `parser`: consists of functions that implement the minishell's grammar and create a tree of a given input by the user\n  - `scanner`: implements a scanner to create tokens of a given input by the user\n  - `signals`: consists of functions that handle user events, such as `ctrl-C`, `ctrl-D` and `ctrl-\\`\n  - `table`: implements a hash table to store enviroment variables\n\n## Project flowchart\n\nIn a nutshell, the project flowchart is as follows:\n\n```mermaid\ngraph LR;\n    INPUT--\u003escanner;\n    scanner--\u003eparser;\n    parser--\u003eexpansor;\n    expansor--\u003eexecutor;\n    executor--\u003eOUTPUT\n```\n\nAs an example, if given the input `true \u0026\u0026 ls || echo` the program generates the tree below to be executed:\n\n```mermaid\ngraph TD;\n    OR--\u003eAND;\n    OR--\u003eecho;\n    AND--\u003etrue;\n    AND--\u003els;\n```\n## References\n\n- General references:\n  - [CS 61: Systems Programming and Machine Organization (2022)](https://cs61.seas.harvard.edu/site/2022/#gsc.tab=0), by Harvard University\n  - NYSTROM, Robert. _Crafting interpreters_. 2020\n  - AHO, Alfred. _Compiladores: princípios, técnicas e ferramentas_. 2007\n  - [Playlist about compilers](https://www.youtube.com/playlist?list=PLX6Nyaq0ebfhI396WlWN6WlBm-tp7vDtV), by [Judson Santiago](https://www.youtube.com/@JudSan)\n  - [Playlist about Programming Languages and Compilers](https://www.youtube.com/playlist?list=PLvat2X-KHJNYmC4M1HHrDkMkFDf8Dwyf8), by [Rafael Ivo](https://www.youtube.com/@ProfessorRafaelIvo)\n  - [Subshell: types and origins](https://www.youtube.com/watch?v=MkejZKVfsRg), by [prog.shell.linux](https://www.youtube.com/@progshelllinux)\n\n\n\n- Useful tools for grammar generation:\n  - [The context free grammar checker](https://smlweb.cpsc.ucalgary.ca/start.html), by [University of Calgary](https://science.ucalgary.ca/computer-science)\n  - [Grammophone: transform context-free grammars](https://mdaines.github.io/grammophone/)\n\n- About hash table implementation\n  - [FNV Hash](http://www.isthe.com/chongo/tech/comp/fnv/#FNV-1a), by [Landon Curt Noll](http://www.isthe.com/chongo/index.html)\n\n- About parser:\n  - [Recursive Descendant Parsing](https://www.youtube.com/watch?v=SToUyjAsaFk), by [hhp3](https://www.youtube.com/@hhp3)\n\n- About syntax analyzer:\n  - [08: Análise Sintática Top Down: Parser Descendente Recursivo](https://www.youtube.com/watch?v=dvql913QHzs) and [10: Análise Preditiva (Parser Recursivo Preditivo](https://www.youtube.com/watch?v=8nb-6Zo_X_0), by [Andre Du Bois](https://www.youtube.com/@andredubois7117)\n  \n- About bonus implementation\n  - [Wildcard Matching with Dynamic Programming](https://www.youtube.com/watch?v=3ZDZ-N0EPV0), by [Tushar Roy](https://www.youtube.com/@tusharroy2525)\n\n- The same project done by fellows 42SP's students\n  - https://github.com/sgkhusal/minishell/\n  - https://github.com/SouzaSA/42sp_minishell.git\n\n- Automated tester that helped us to find some bugs: \n  - https://github.com/LucasKuhn/minishell_tester\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagalhaesm%2Fminishell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagalhaesm%2Fminishell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagalhaesm%2Fminishell/lists"}