{"id":31026218,"url":"https://github.com/tristanbilot/42sh","last_synced_at":"2026-05-05T19:32:21.193Z","repository":{"id":111593233,"uuid":"249492123","full_name":"TristanBilot/42sh","owner":"TristanBilot","description":"Shell implementation in pure C \u0026 Assembly x86","archived":false,"fork":false,"pushed_at":"2020-06-04T09:31:10.000Z","size":21338,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-13T18:14:35.744Z","etag":null,"topics":["abstract-syntax-tree","assembly","c","linux","shell"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TristanBilot.png","metadata":{"files":{"readme":"README.md","changelog":"history","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-03-23T17:01:05.000Z","updated_at":"2024-07-12T08:13:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"56d8c2a4-9ee9-45c1-872d-6f87d70038ab","html_url":"https://github.com/TristanBilot/42sh","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TristanBilot/42sh","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TristanBilot%2F42sh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TristanBilot%2F42sh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TristanBilot%2F42sh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TristanBilot%2F42sh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TristanBilot","download_url":"https://codeload.github.com/TristanBilot/42sh/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TristanBilot%2F42sh/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32664862,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-05T11:29:49.557Z","status":"ssl_error","status_checked_at":"2026-05-05T11:29:48.587Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["abstract-syntax-tree","assembly","c","linux","shell"],"created_at":"2025-09-13T17:59:18.882Z","updated_at":"2026-05-05T19:32:21.188Z","avatar_url":"https://github.com/TristanBilot.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 42sh\n\n42sh was a team project made at EPITA in which we had to implement a POSIX shell from scratch using pure C. No memory leaks were allowed and we needed to implement by ourselves most of useful C functions.\nOur 42sh do not use standard builtins so we had to create the famous ones like echo, source, continue, break, exit, export...\n\nAuthors: \nBilot Tristan |\nDelfau Nora |\nSalemi Enzar |\nThambithurai Madushan\n\n- [x] POSIX compliant\n- [x] no memory leaks\n- [x] no warnings/errors\n- [x] tested on ArchLinux, Ubuntu, MacOS\n\n## Usage\n### Build the shell (3 ways)\n    1. ./build.sh\n    2. mkdir build \u0026\u0026 cd build \u0026\u0026 cmake . \u0026\u0026 make\n    3. cmake . \u0026\u0026 make\n    \n### Run the shell\n    1. ./build/42sh\n    2. ./42sh (only if built with the #3 way)\n    \n### Generate Doxygen documentations\n    1. ./build.sh doc         (this will build/rebuild the 42sh before)\n    2. cd build \u0026\u0026 make doc   (if the shell is already built)\n    3. ./documentation.sh     (if the shell is already built)\n    4. make doc               (if shell built with the 3rd way)\n\n### Read Doxygen documentaions\n    -- evince doc/latex/refman.pdf\n    -- cd doc/man/man3 \u0026\u0026 man ./[SOURCE FILE NAME].3\n    -- firefox doc/html/index.html\n\n### Run the python testsuite\n    1. ./build.sh check       (this will build/rebuild the 42sh before)\n    2. cd build \u0026\u0026 make check (if the shell is already built)\n    3. make check             (if shell built with the 3rd way)\n\n### Clean the project (3 ways)\n    1. ./clean.sh\n    2. cd build \u0026\u0026 make clean\n    3. make clean\n\n## Commands\n### Command substitution\n\n```shell\necho $(ls -la \u0026\u0026 pwd)\n```\n\n### Arithmetic substitution\n\n```shell\necho $((2*33/2-2))\n```\n\n```shell\necho $((!3\u0026\u00261 || 3))\n```\n\n```shell\necho $((~2- ~3 + ~1\u0026\u0026 ~4/4-1))\n```\n\n### Redirections and pipes\n\n```shell\n./42sh 2\u003e/dev/null \u003e/dev/null\n```\n\n```shell\ntree . | ./42sh \u003e\u003e file\n```\n\n```shell\ncat\u003c test_suite.py\n```\n\n### Variables and aliases\n\n```shell\nvar=$(echo 42); echo $var\n```\n\n```shell\necho $RANDOM${UID}\n```\n\n```shell\nalias ll=\"ls -l\"; ll; unalias ll\n```\n\n```shell\nexport PWD=\"/bin\"; export\n```\n\n### Loops\n\n```shell\nfor i in a b c d e; do echo \"Hello, world !\"; done\n```\n\n```shell\nfor i in {0..42}; do echo \"current: $i\"; done\n```\n\n```shell\nwhile ! echo a | echo b | echo c; do echo toto; done\n```\n\n```shell\nuntil echo a | echo b | echo c; do echo toto; done\n```\n\n### Conditions\n\n```shell\nif cat README; then echo success; elif ls; then echo success; else echo failed; fi\n```\n\n```shell\nif echo toto; then echo success; else echo failed; fi\n```\n\n```shell\ncase a in b | c | d ) hello \u0026 ;; esac\n```\n\n### Binary operators\n\n```shell\n( a || ( ( b \u0026\u0026 c; ) || ls\\n ); )\n```\n\n### Signals and History\n\nKey|Signal|\n:-:|:--\n\u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003eC\u003c/kbd\u003e\u003cbr\u003e\u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003eZ\u003c/kbd\u003e\u003cbr\u003e\u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003eL\u003c/kbd\u003e|Kill current process\u003cbr\u003eSuspend curent process\u003cbr\u003eClear shell\n\u003ckbd\u003eTab\u003c/kbd\u003e\u003cbr\u003e|Autocompletion\n\u003ckbd\u003e^\u003c/kbd\u003e\u003cbr\u003e\u003ckbd\u003ev\u003c/kbd\u003e|Browse history\n\u003ckbd\u003e\u003c\u003c/kbd\u003e\u003cbr\u003e\u003ckbd\u003e\u003e\u003c/kbd\u003e|Browse current command\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftristanbilot%2F42sh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftristanbilot%2F42sh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftristanbilot%2F42sh/lists"}