{"id":27771581,"url":"https://github.com/el-ouardy/simple_shell","last_synced_at":"2025-04-29T22:43:54.795Z","repository":{"id":200745745,"uuid":"705691090","full_name":"EL-OUARDY/simple_shell","owner":"EL-OUARDY","description":"Create a basic custom shell that mimics the functionality of a Linux shell — ALX software engineering program","archived":false,"fork":false,"pushed_at":"2023-10-19T01:56:48.000Z","size":31,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-29T22:43:51.495Z","etag":null,"topics":["alx","c","holberton","linux-shell","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/EL-OUARDY.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}},"created_at":"2023-10-16T14:03:55.000Z","updated_at":"2023-12-15T15:25:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"f046262d-f2d8-4dd1-89fc-386e5392afe5","html_url":"https://github.com/EL-OUARDY/simple_shell","commit_stats":null,"previous_names":["el-ouardy/simple_shell"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EL-OUARDY%2Fsimple_shell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EL-OUARDY%2Fsimple_shell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EL-OUARDY%2Fsimple_shell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EL-OUARDY%2Fsimple_shell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EL-OUARDY","download_url":"https://codeload.github.com/EL-OUARDY/simple_shell/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251596613,"owners_count":21615014,"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":["alx","c","holberton","linux-shell","shell"],"created_at":"2025-04-29T22:43:54.258Z","updated_at":"2025-04-29T22:43:54.780Z","avatar_url":"https://github.com/EL-OUARDY.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ALX — Custom `Simple Shell` Project in C Language\n\n## Project Overview\nThis is a simple shell project developed as part of **ALX software engineering program**. The goal of this project is to create a basic shell that mimics the functionality of a Linux shell.\n\n\n## Requirements\n### Output\nUnless specified otherwise, your program must have the exact same output as ``sh`` (``/bin/sh``) as well as the exact same error output.\nThe only difference is when you print an error, the name of the program must be equivalent to your ``argv[0]`` (See below)\\\nExample of error with ``sh``:\n\n```bash\n$ echo \"qwerty\" | /bin/sh\n/bin/sh: 1: qwerty: not found\n$ echo \"qwerty\" | /bin/../bin/sh\n/bin/../bin/sh: 1: qwerty: not found\n$\n```\n\nSame error with your program hsh:\n\n```bash\n$ echo \"qwerty\" | ./hsh\n./hsh: 1: qwerty: not found\n$ echo \"qwerty\" | ./././hsh\n./././hsh: 1: qwerty: not found\n$\n```\n### Testing\nYour shell should work like this in interactive mode:\n```bash\n$ ./hsh\n($) /bin/ls\nhsh main.c shell.c\n($)\n($) exit\n$\n```\nBut also in non-interactive mode:\n```bash\n$ echo \"/bin/ls\" | ./hsh\nhsh main.c shell.c test_ls_2\n$\n$ cat test_ls_2\n/bin/ls\n/bin/ls\n$\n$ cat test_ls_2 | ./hsh\nhsh main.c shell.c test_ls_2\nhsh main.c shell.c test_ls_2\n$\n```\n## Allowed functions and system calls\n``access`` / \n``chdir`` / \n``close`` / \n``closedir`` / \n``execve`` / \n``exit`` / \n``_exit`` / \n``fflush`` / \n``fork`` / \n``free`` / \n``getcwd`` / \n``getline`` / \n``getpid`` / \n``isatty`` / \n``kill`` / \n``malloc`` / \n``open`` / \n``opendir`` / \n``perror`` / \n``read`` / \n``readdir`` / \n``signal`` / \n``stat`` / \n``lstat`` / \n``fstat`` / \n``strtok`` / \n``wait`` / \n``waitpid`` / \n``wait3`` / \n``wait4`` / \n``write`` / \n\n## Compilation\nProgram will be compiled this way:\n```bash\ngcc -Wall -Werror -Wextra -pedantic -std=gnu89 *.c -o hsh\n```\n\n## Steps to Implement\n1. Create a loop to continuously accept user commands.\n2. Parse the user input to identify the command and its arguments.\n3. Execute the command with **execve()** in a child process created using **fork()**.\n4. Handle non fullpath command \\\n5. Process built-in commands such as exit, cd, env ...etc \\\n``... MORE STEPS WILL BE ADDED AS WE PROGRESS IN THE PROJECT``\n\n## Project File Structure:\n1. `shell.h` — header file that contains all used functions and custom struct types.\n1. `main.c` — contains the primary function of our shell, serving as the program's entry point and featuring the foundational code for our shell's operation.\n1. `command.c` — function to perform operations on the shell command.\n1. `arguments.c` —  functions for handling and parsing command-line arguments passed to our custom shell.\n1. `builtin.c` — contains functions to handle builtin commands.\n1. `strings.c` — this file encompasses all the functions to deal with strings.\n1. `lists.c` — contains all function to manipulate linked lists.\n1. `environment.c` — functions for manage and interact with the environment variables, including setting, getting, or modifying environment settings.\n1. `errors.c` — handle error messages.\n1. `cleanup.c` —  includes functions responsible for cleaning up resources, ensuring proper termination and avoiding memory leaks.\n1. `_getline.c` —  custom implementation of the built-in **getline** function.\n1. `_strtok.c` —  personalized version of the native **strtok** string tokenization function.\n\n\n## Team Members:\n**Hamza Dazia** — [*https://github.com/HamzaDazai*](https://github.com/HamzaDazai) \\\n**Ouadia EL-Ouardy** — [*https://github.com/EL-OUARDY*](https://github.com/EL-OUARDY)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fel-ouardy%2Fsimple_shell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fel-ouardy%2Fsimple_shell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fel-ouardy%2Fsimple_shell/lists"}