{"id":18791752,"url":"https://github.com/phip1611/bash-like-cpp-shell","last_synced_at":"2026-02-28T19:01:31.958Z","repository":{"id":69702640,"uuid":"295801412","full_name":"phip1611/bash-like-cpp-shell","owner":"phip1611","description":"A demo bash-like shell for educational purposes - shows basics about pipes, fork and a lot of other UNIX facilities.","archived":false,"fork":false,"pushed_at":"2026-02-01T10:45:24.000Z","size":150,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-01T20:39:30.127Z","etag":null,"topics":["cpp","pipes","readline-library","shell","unix-facilities"],"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/phip1611.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"phip1611"}},"created_at":"2020-09-15T17:28:07.000Z","updated_at":"2026-02-01T10:45:27.000Z","dependencies_parsed_at":"2025-02-03T10:23:33.552Z","dependency_job_id":"012021c1-8086-4b15-b490-470244988973","html_url":"https://github.com/phip1611/bash-like-cpp-shell","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/phip1611/bash-like-cpp-shell","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phip1611%2Fbash-like-cpp-shell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phip1611%2Fbash-like-cpp-shell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phip1611%2Fbash-like-cpp-shell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phip1611%2Fbash-like-cpp-shell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phip1611","download_url":"https://codeload.github.com/phip1611/bash-like-cpp-shell/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phip1611%2Fbash-like-cpp-shell/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29948228,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T18:42:55.706Z","status":"ssl_error","status_checked_at":"2026-02-28T18:42:48.811Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["cpp","pipes","readline-library","shell","unix-facilities"],"created_at":"2024-11-07T21:16:45.869Z","updated_at":"2026-02-28T19:01:31.928Z","avatar_url":"https://github.com/phip1611.png","language":"C++","funding_links":["https://github.com/sponsors/phip1611"],"categories":[],"sub_categories":[],"readme":"# phipsshell - a simple bash-like shell written in C++\n\n\u003c!-- This is an old project from 2020. I slightly modernized it in Mid-2024 but\n     this was not a major refactoring. --\u003e\n\n## About\nI had to write a shell for an uni project a few semesters ago. I did this\nin C and the outcome was quite interesting. I learned a lot about `pipes`, `file\ndescriptors`, `fork`, `exec`, and some other `UNIX` facilities. I wanted to revive\nthis project and open source it to keep the learnings in my memory and to\nshare them with other people facing this task. So I took the code from then and\nrewrote ugly parts in C++.\n\n**Focus is educational and for personal experience - not a production-ready shell!**\n\n## Code and code quality\nI'm not an experienced C++ developer. My testing so far (valgrind) shows I\nhave no memory leaks and the overall code quality looks at least \"okay\" to\nme. At least the important parts! The parsing and validation stuff is not\nreally solid, tho. But I spend some time into making the actual execution\nand Pipe creation + handling nice.\n\n**Important parts of code**: See `action.cpp: action_command()` and `pipe.class.cpp: Pipe()`.\n\n## Functionality\nThis shell focuses on **proper user input**! Validation is only very coarse-grained and\ndefinitely not bullet-proof! The focus here is on understanding pipes and not in writing\na good parser. **Only single spaces** are allowed and **no quote marks!**\n`echo \"foo  bar\"` won't work.\n\nValid inputs are (subset of bash):\n#### simple commands\n- `cat file.txt`\n- `/usr/bin/cat file.txt`\n- `./mybin file.txt`\n\n#### pipes\n- `cat file.txt | wc -l`\n\n#### I/O redirection\n- `cat \u003c in.txt`\n- `cat in.txt \u003e out.txt`\n- `cat \u003c in.txt | wc -l \u003e out.txt`\n- `cat \u003c in.txt \u003e out.txt` **doesn't work because my whole parsing code is not that good**\n\n#### all in combination\n- `cat in.txt | grep -i foo | wc -l \u003e out.file`\n\n## How to use/build phipsshell?\nRuns on UNIX systems, like Linux distributions or Mac OS.\n#### Linux (Debian, Ubuntu)\n- `$ sudo apt install libreadline-dev`\n- `$ make \u0026\u0026 ./phipsshell`\n#### Mac OS\n- `$ brew install readline` (installs only the runtime library, not the header files; therefore the header files are in ./include)\n- `$ make \u0026\u0026 ./phipsshell`\n\n## Important parts of code\nSee `action.cpp: action_command()` and `pipe.class.cpp: Pipe()`.\n\n## Why Makefile and CMakeLists.txt?\nAt the begin there was only the makefile. Because I wanted to use Jetbrains CLion I\nalso added a CMakeLists.txt. Both files works fine. I keep the Makefile because I\nthink it's 'nice' and I don't want to loose it.\n\n## Dependencies\n*phipsshell* uses [libreadline](https://tiswww.case.edu/php/chet/readline/rltop.html).\nReadline is distributed under a [GPL v3 License](https://www.gnu.org/licenses/gpl-3.0.html).\nThis repository contains a few header files (copied from the original source) in order to\nsupport compiling on MacOS. That is because `brew install readline` doesn't install header\nfiles.\n\n## Important Keywords for used UNIX facilities\n- pipes, file descriptors, waitpid, WNOHANG, dup2\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphip1611%2Fbash-like-cpp-shell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphip1611%2Fbash-like-cpp-shell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphip1611%2Fbash-like-cpp-shell/lists"}