{"id":20287049,"url":"https://github.com/codewithsegnet/simple_shell","last_synced_at":"2025-12-03T07:14:06.391Z","repository":{"id":147741744,"uuid":"562826019","full_name":"CodewithSegNet/simple_shell","owner":"CodewithSegNet","description":"TEAM PROJECT","archived":false,"fork":false,"pushed_at":"2023-02-08T10:34:28.000Z","size":113,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-14T08:23:30.456Z","etag":null,"topics":["c","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/CodewithSegNet.png","metadata":{"files":{"readme":"README.md","changelog":"history.c","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,"publiccode":null,"codemeta":null}},"created_at":"2022-11-07T10:43:06.000Z","updated_at":"2023-02-08T10:23:55.000Z","dependencies_parsed_at":"2023-05-27T09:15:15.737Z","dependency_job_id":null,"html_url":"https://github.com/CodewithSegNet/simple_shell","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodewithSegNet%2Fsimple_shell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodewithSegNet%2Fsimple_shell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodewithSegNet%2Fsimple_shell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodewithSegNet%2Fsimple_shell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodewithSegNet","download_url":"https://codeload.github.com/CodewithSegNet/simple_shell/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241780497,"owners_count":20019061,"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","shell"],"created_at":"2024-11-14T14:37:58.515Z","updated_at":"2025-12-03T07:14:01.355Z","avatar_url":"https://github.com/CodewithSegNet.png","language":"C","readme":"# Simple Shell Project\n\n**A simple Unix command line interpreter**\n![shell](/shell.png)\n\n****\n## Table of contents\n - **What is the shell?**\n - **About this project**\n - **Essential Functionalities of the Simple Shell**\n - **File description**\n - **List of allowed functions and system calls for this project**\n - **USAGE**\n - **Example of Usage**\n - **Bugs**\n - **TEAM**\n ****\n\n## What is the shell?\nThe shell is a program that takes commands from the keyboard via the terminal, and gives them to the operating system to perform.\\\n**To better understand how the shell actually works, you can read our [Article].**\n\n## About this project\nThis project is a simple version of the linux shell made for [ALX-SOFTWARE ENGINEERING PROGRAM] taking part of the \"Low-level programming \u0026 Algorithm - Linux and Unix system programming\" projects.\\\nIt is created using the **C programming Language** and it can do many functionalities that a real shell does.\n\n## Essential Functionalities of the Simple Shell:\n\u003e Displays a prompt \"#cisfun$ \" and waits for user input.\\\n\u003e Runs all commands of type \"executable program\" (ls and /bin/ls).\\\n\u003e Runs the following build_in commands: **exit**, **env**, **setenv** and **unsetenv**.\\\n\u003e Handles commands with arguments.\\\n\u003e Handles the PATH global variable.\\\n\u003e Handles The EOF (End Of File) condition.\\\n\u003e Handles the Ctrl + C signal -\u003e It doesn't exit the shell\n\n## Files description\n - **AUTHORS** -\u003e List of contributors to this repository\n - **man_1_simple_shell** -\u003e Manual page for the simple_shell\n - **shell.h** -\u003e Header file\n - **shell.c** -\u003e main function\n\t- **sig_handler** -\u003e handles the Ctrl + C signal\n\t- **_EOF** -\u003e handles the End Of File condition\n - **string.c**\n\t- **_putchar** -\u003e prints a character\n\t- **_puts** -\u003e prints a string\n\t- **_strlen** -\u003e gives the length of a string\n\t- **_strdup** -\u003e copies a string in a newly allocated memory\n\t- **concat_all** -\u003e concatenates 3 strings in a newly allocated memory\n - **line_exec.c**\n\t- **splitstring** -\u003e splits a string into an array of words\n\t- **execute** -\u003e executes a command using execve\n\t- **realloc** -\u003e reallocates a memory block\n\t- **freearv** -\u003e frees a 2 dimensional array\n - **linkpath.c**\n\t- **_getenv** -\u003e returns the value of a global variable\n\t- **add_node_end** -\u003e adds a node in a singly linked list\n\t- **linkpath** -\u003e creates a singly linked list for PATH directories\n\t- **_which** -\u003e finds the pathname of a command\n\t- **free_list** -\u003e frees the linked list of PATH value\n - **checkbuild.c**\n\t- **checkbuild** -\u003e checks if a command is a build-in command\n - **buildin.c**\n\t- **exitt** -\u003e handles the exit buildin command\n\t- **_atoi** -\u003e converts a string into an integer\n\t- **env** -\u003e prints the current environment\n\t- **_setenv** -\u003e Initialize a new global variable, or modify an existing one\n\t- **_unsetenv** -\u003e remove a global variable\n\n****\n## List of allowed functions and system calls for this project\n - access (man 2 access)\n - chdir (man 2 chdir)\n - close (man 2 close)\n - closedir (man 3 closedir)\n - execve (man 2 execve)\n - exit (man 3 exit)\n - _exit (man 2 _exit)\n - fflush (man 3 fflush)\n - fork (man 2 fork)\n - free (man 3 free)\n - getcwd (man 3 getcwd)\n - getline (man 3 getline)\n - isatty (man 3 isatty)\n - kill (man 2 kill)\n - malloc (man 3 malloc)\n - open (man 2 open)\n - opendir (man 3 opendir)\n - perror (man 3 perror)\n - read (man 2 read)\n - readdir (man 3 readdir)\n - signal (man 2 signal)\n - stat (__xstat) (man 2 stat)\n - lstat (__lxstat) (man 2 lstat)\n - fstat (__fxstat) (man 2 fstat)\n - strtok (man 3 strtok)\n - wait (man 2 wait)\n - waitpid (man 2 waitpid)\n - wait3 (man 2 wait3)\n - wait4 (man 2 wait4)\n - write (man 2 write)\n****\n\n## USAGE\nYou can try our shell by following these steps:\n\u003e **Step 1:** Clone our repository using this command, (you need to have git installed on your machine first)\n````\ngit clone https://github.com/CodewithSegNet/simple_shell\n````\n\u003e **Step 2:** Change directory to simple_shell:\n````\ncd simple_shell\n````\n\u003e **Step 3:** Compile the C files in this way:\n````\ngcc -Wall -Werror -Wextra -pedantic *.c -o hsh\n````\n\u003e **Step 4:** Run the shell\n````\n./hsh\n````\n**Exiting the shell**\nWhen you want to exit the shell, you can use one of the following methods:\n\u003e **1: Type the command \"exit\"**\n````\nexit\n````\n\u003e **2: Press on Ctrl + D**\n\n## Example of Usage\n````\nubunto@ubuntu:~/Bureau/simple_shell$ gcc -Wall -Wextra -Werror -pedantic *.c -o hsh\nubunto@ubuntu:~/Bureau/simple_shell$ ./hsh\n#cisfun$ echo Hello, This is an example\nHello, This is an example\n#cisfun$ ls\nREADME.md  checkbuild.c  line_exec.c  shell.c  string.c\nbuildin.c  hsh\t\t linkpath.c   shell.h\n#cisfun$ ^C\n#cisfun$ ls -l\ntotal 52\n-rw-r--r-- 1 ubunto ubunto  3067 Nov 26 04:22 README.md\n-rw-r--r-- 1 ubunto ubunto  2183 Nov 24 16:17 buildin.c\n-rw-r--r-- 1 ubunto ubunto   574 Nov 24 15:59 checkbuild.c\n-rwxr-xr-x 1 ubunto ubunto 18144 Nov 26 04:22 hsh\n-rw-r--r-- 1 ubunto ubunto  2091 Nov 24 14:49 line_exec.c\n-rw-r--r-- 1 ubunto ubunto  1926 Nov 24 14:30 linkpath.c\n-rw-r--r-- 1 ubunto ubunto   951 Nov 24 16:09 shell.c\n-rw-r--r-- 1 ubunto ubunto  1351 Nov 24 15:58 shell.h\n-rw-r--r-- 1 ubunto ubunto  1727 Nov 24 14:30 string.c\n#cisfun$ exit\nubunto@ubuntu:~/Bureau/simple_shell$\n````\n## Bugs\nNo known Bugs.\n\n## contributors\n\n* [Olusegun Emmanuel](https://github.com/codewithsegnet/simpl_shell/)\n* [HasimKaliq](https://github.com/HasimKaliq/)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithsegnet%2Fsimple_shell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodewithsegnet%2Fsimple_shell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithsegnet%2Fsimple_shell/lists"}