{"id":28321214,"url":"https://github.com/uosyph/simple_shell","last_synced_at":"2026-05-08T15:02:30.056Z","repository":{"id":152940382,"uuid":"627626335","full_name":"uosyph/simple_shell","owner":"uosyph","description":"UNIX command interpreter built to take in commands and execute text-based programs.","archived":false,"fork":false,"pushed_at":"2023-04-27T07:58:09.000Z","size":52,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-01T20:50:44.212Z","etag":null,"topics":["c","cli","linux","linux-shell","shell","unix","unix-shell"],"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/uosyph.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}},"created_at":"2023-04-13T21:29:10.000Z","updated_at":"2023-04-20T01:25:26.000Z","dependencies_parsed_at":"2024-01-05T01:30:09.721Z","dependency_job_id":"fdaad472-fd03-442d-b7be-2524277d46e4","html_url":"https://github.com/uosyph/simple_shell","commit_stats":null,"previous_names":["uosyph/simple_shell"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/uosyph/simple_shell","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uosyph%2Fsimple_shell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uosyph%2Fsimple_shell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uosyph%2Fsimple_shell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uosyph%2Fsimple_shell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uosyph","download_url":"https://codeload.github.com/uosyph/simple_shell/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uosyph%2Fsimple_shell/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261487012,"owners_count":23166004,"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","linux","linux-shell","shell","unix","unix-shell"],"created_at":"2025-05-25T12:13:24.718Z","updated_at":"2026-05-08T15:02:25.012Z","avatar_url":"https://github.com/uosyph.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca name=\"readme-top\"\u003e\u003c/a\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cp align=\"center\"\u003e\n        \u003cimg src=\"https://bashlogo.com/img/symbol/png/monochrome_light.png\" width=\"180\"\u003e\n    \u003c/p\u003e\n    \u003cp align=\"center\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/C-00599C?style=for-the-badge\u0026logo=c\u0026logoColor=white\" height=\"26\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Shell_Script-121011?style=for-the-badge\u0026logo=gnu-bash\u0026logoColor=white\" height=\"26\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Linux-FCC624?style=for-the-badge\u0026logo=linux\u0026logoColor=black\" height=\"26\"\u003e\n    \u003c/p\u003e\n\u003c/p\u003e\n\n# Simple Shell\nA UNIX command interpreter written in C, built to take in commands and execute text-based programs.\n\n## Table of Contents\n- [Introduction](#introduction)\n  - [What is a shell](#what-is-a-shell)\n  - [What is the purpose of a shell](#what-is-the-purpose-of-a-shell)\n  - [How does the shell provide a user environment](#how-does-the-shell-provide-a-user-environment)\n  - [How does the shell interpret user input](#how-does-the-shell-interpret-user-input)\n- [Documentation](#documentation)\n  - [Compilation](#compilation)\n  - [Usage](#usage)\n  - [Files](#files)\n- [Acknowledgements](#acknowledgements)\n\n## Introduction\n\n### What is a shell\nA **shell** is a command-line interpreter, it is a program that provides an interface between a user and an [operating system kernel](https://en.wikipedia.org/wiki/Kernel_(operating_system)). It is a program that executes other programs in response to text commands. The shell gathers input from the user and executes programs based on that input. The shell is both an interactive command language and a scripting language, and is used by the operating system to control the execution of the system using shell scripts. A sophisticated shell can also change the environment in which other programs execute by passing named variables, a parameter list, or an input source.\n\n### What is the purpose of a shell\nThe shell is the most important program on the Unix system from the end-user's standpoint. It allows users to execute utilities and programs by interfacing with the kernel. The shell also provides a [command-line interface](https://en.wikipedia.org/wiki/Command-line_interface), similar to [DOS](https://en.wikipedia.org/wiki/DOS), that allows users to interact with the operating system. Most shells double as interpreted programming languages, allowing users to automate tasks by writing scripts containing built-in shell and Unix commands. The shell's main advantages are its high action-to-keystroke ratio, its support for automating repetitive tasks, and its capacity to access networked machines.\n\n### How does the shell provide a user environment\nThe shell provides a user environment that can be customized using initialization files. These files contain settings for user environment characteristics, such as search paths for finding commands, default permissions on new files, values for variables that other programs use, and values that can be customized. The shell maintains an environment that includes a set of variables defined by the login program, the system initialization file, and the user initialization. The shell also allows users to set environment variables, which are used by the shell and other programs to determine how they behave.\n\nThe shell's environment is typically stored in the user's profile, for example in the local passwd file or in a configuration file in the user's home directory. The shell's environment can be modified by the user or by shell scripts, allowing users to customize their environment to suit their needs. The shell's environment can also be inherited by child processes, allowing them to access the same environment variables and settings as the parent process.\n\n### How does the shell interpret user input\nThe shell interprets user input by reading the input and determining the command to be executed by looking at the first word of the input. The shell then searches for the command in the directories specified in the user's PATH environment variable. If the command is found, the shell executes it by creating a new process to run the command. The shell also provides a mechanism for redirecting input and output, allowing users to control where the output of a command is sent and where the input for a command comes from.\n\nThe shell can also read input from the user using the read built-in command. The read command reads one line from the standard input and assigns the first word of the line to the first variable specified, the second word to the second variable, and so on. If no variables are specified, the line read is assigned to the variable REPLY. The shell also provides a mechanism for passing arguments to a command, allowing users to customize the behavior of a command by specifying options and arguments on the command line.\n\n## Documentation\n\n### Compilation\nHow to compile the shell:\n\n```bash\ngcc -Wall -Werror -Wextra -pedantic *.c -o hsh\n```\n\n### Usage\n\nWorking in interactive and non-interactive mode:\n\n```bash\n$ ./hsh\n($) /bin/ls\nhsh main.c shell.c\n($)\n($) exit\n$\n```\n\n### Files\n\n|File|Description|\n|---|---|\n|[_builtin.c](_bulitin.c)|Built-ins functions exit and print environment.|\n|[_fork_function.c](_fork_function.c)|Create the fork function to execute the command typed by the user.|\n|[_get_path.c](_get_path.c)|Get the environment to find the PATH.|\n|[_get_token.c](_get_token.c)|Tokenize the strings.|\n|[_getline_command.c](_getline_command.c)|Print \"**$**\" and get user input.|\n|[_str_utils.c](_str_utils.c)|Auxiliary strings functions.|\n|[_strtok.c](_strtok.c)|String token functions.|\n|[_values_path.c](_values_path.c)|Concatenate the path with the command.|\n|[shell.h](shell.h)|Prototypes functions and headers.|\n|[simple_shell.c](simple_shell.c)|The shell functions.|\n\n## Acknowledgements\n\n- [Command-line interpreters](https://en.wikipedia.org/wiki/List_of_command-line_interpreterss)\n- [Command-line interface](https://en.wikipedia.org/wiki/Command-line_interface)\n- [Unix shell](https://en.wikipedia.org/wiki/Unix_shell)\n- [sh (Bourne shell)](https://en.wikipedia.org/wiki/Bourne_shell)\n- [**Write a Shell in C** by *Stephen Brennan*](https://brennan.io/2015/01/16/write-a-shell-in-c/)\n- [Chapter \"**Writing Your Own Shell**\" in the book \"**Introduction to Systems Programming**\" by *Gustavo Rodríguez-Rivera*](https://www.cs.purdue.edu/homes/grr/SystemsProgrammingBook/Book/Chapter5-WritingYourOwnShell.pdf)\n\n\u003cp align=\"right\"\u003e\u003ca href=\"#readme-top\"\u003eBack to Top\u003c/a\u003e\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuosyph%2Fsimple_shell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuosyph%2Fsimple_shell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuosyph%2Fsimple_shell/lists"}