{"id":17817604,"url":"https://github.com/codelixir/shella-ciao","last_synced_at":"2026-05-10T03:09:12.221Z","repository":{"id":233798062,"uuid":"408087094","full_name":"codelixir/shella-ciao","owner":"codelixir","description":"Linux shell written in C language supporting some basic and user-defined commands","archived":false,"fork":false,"pushed_at":"2021-10-12T07:13:24.000Z","size":290,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T09:13:40.450Z","etag":null,"topics":["c","cli","hacktoberfest","linux","shell","unix"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codelixir.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2021-09-19T09:41:26.000Z","updated_at":"2024-09-14T20:02:20.000Z","dependencies_parsed_at":"2024-04-17T11:18:36.412Z","dependency_job_id":"6d8e6141-e163-4d5c-b381-168406684055","html_url":"https://github.com/codelixir/shella-ciao","commit_stats":null,"previous_names":["codelixir/shella-ciao"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codelixir/shella-ciao","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelixir%2Fshella-ciao","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelixir%2Fshella-ciao/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelixir%2Fshella-ciao/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelixir%2Fshella-ciao/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codelixir","download_url":"https://codeload.github.com/codelixir/shella-ciao/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelixir%2Fshella-ciao/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260497474,"owners_count":23018240,"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","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":["c","cli","hacktoberfest","linux","shell","unix"],"created_at":"2024-10-27T16:44:32.733Z","updated_at":"2026-05-10T03:09:12.158Z","avatar_url":"https://github.com/codelixir.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shella Ciao\n\n[![forthebadge](https://forthebadge.com/images/badges/made-with-c.svg)](https://forthebadge.com)\n\n## Running the Shell\n\n```sh\n$ cd code\n$ make\n...\n$ ./a.out\n```\n\n## Commands and other features\n\n`cd`, `echo`, `exit`, `ls`, `pinfo`, `pwd`, `repeat`, `jobs`, `sig`, `fg`, `bg` and system commands (`vi`, `subl`, etc)\n\n- Piping ( `cmd1 | cmd 2 `  etc.)\n- Redirection ( `cmd \u003c input_file \u003e\u003e output_file`  etc.)\n- Keyboard interrupts (`Ctrl+C`, `Ctrl+D`, etc.)\n\nFor knowing more about how the 'user-defined' commands work (commands which are different from standard bash/zsh commands), you can check [Part 1](Assignment%20Part%201.pdf) for `pinfo` or `repeat`, and [Part 2](Assignment%20Part%202.pdf) for `jobs`, `sig`, `fg` or `bg`.\n\n## Code Files\n\n| Files                 | Description |\n| --------------------- | ----------- |\n| bg.c, bg.h | Implementing the user defined `bg` command |\n| cd.c, cd.h            | Implementing the `cd` command (navigate to a directory). The command takes up to one argument. |\n| echo.c, echo.h        | Implementing the `echo` command (printing to the console). Tabs and multiple spaces are handled.        |\n| execute.c, execute.h  | Contains the function for handling all commands and calling the respective functions. **This also takes care of any redirects like \u003e, \u003e\u003e, \u003c**        |\n| fg.c, fg.g | Implementing the user defined `fg` function.|\n| headers.h | Including all external header files          |\n| handlers.c, handlers.h | Contains custom defined signal handler functions. Includes handlers for ^C, ^Z and background processes. |\n| jobs.c, jobs.h | Implementation for user defined `jobs` command. Takes the flags `-s`, `-r`, `-sr`, `-rs`. If no flags are given, defaults to `rs` mode. |\n| ls.c, ls.h | Implementing `ls` including multiple arguments (both files and directories) and flags `-l` and `-a`.         |\n| main.c | The main function of the program. After initializing the shell, it reads input from the user, adds it to history, tokenizes it into commands, and sends it into the `execute` function (`execute.c`)            |\n| pinfo.c, pinfo.h      | Implementing the user-defined `pinfo` command. It takes information about the process from `/proc` directory and prints selected information on the terminal.        |\n| pipe.c, pipe.h | Implements piping. Contains a `master` function which is called recursively to take care of everything including multiple piping and any combination of piping and redirection. |\n| prompt.c, prompt.h    | Controls the shell prompt, for example, ```\u003cpahulpreetsingh@MacBook-Pro:~/\u003e``` Here, `~` is the directory from which the shell is executed.        |\n| pwd.c, pwd.h          | Implements `pwd` command (prints present working directory)        |\n| redirection.c, redirection.h | Includes a function called `check_redirection` which is called from within `execute`. Before the commands are executed, this simplifies the command and reallocates stdin/stdout according to the specified symbols (`\u003e/\u003e\u003e/\u003c`). |\n| repeat.c, repeat.h    | Implements `repeat` command (`repeat n [cmd]`)        |\n| sig.c, sig.h | Implements the user defined `sig` command (`sig [jobnum] [signum]`) |\n| syscom.c, syscom.h    | Implementing system commands using `execvp()`        |\n| utils.c, utils.h      | Some utility functions that I use across files, for example `untildefy()` and `tildefy()` (converts path relative to `~` to absolute path, and vice versa), and other functions.        |\n\n## Assumptions\n\n| Feature/String | Limits |\n| -------------- | ------------- |\n| All paths      | 1024 chars |\n| User input     | 256 chars, 32 commands |\n| Command arguments        | 32 (excluding flags) |\n\n(For in-built commands) There are some commands that work *slightly* differently on different versions of bash and zsh. In such cases, I have followed the behavior of bash-3.2.\n\n---\n*This was built as a part of the Operating Systems and Networks course, Monsoon 2021.*","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodelixir%2Fshella-ciao","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodelixir%2Fshella-ciao","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodelixir%2Fshella-ciao/lists"}