{"id":25557938,"url":"https://github.com/osiota10/simple_shell","last_synced_at":"2026-04-12T18:22:03.417Z","repository":{"id":62949039,"uuid":"563921018","full_name":"osiota10/simple_shell","owner":"osiota10","description":"ALX Software Engineering group project work","archived":false,"fork":false,"pushed_at":"2022-11-12T18:04:03.000Z","size":56,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-31T13:07:19.311Z","etag":null,"topics":["bash","c","linux","posix","shell","shell-scripts","syscall","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/osiota10.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}},"created_at":"2022-11-09T16:03:36.000Z","updated_at":"2023-05-01T03:05:40.000Z","dependencies_parsed_at":"2022-11-09T18:15:18.269Z","dependency_job_id":null,"html_url":"https://github.com/osiota10/simple_shell","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/osiota10/simple_shell","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osiota10%2Fsimple_shell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osiota10%2Fsimple_shell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osiota10%2Fsimple_shell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osiota10%2Fsimple_shell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/osiota10","download_url":"https://codeload.github.com/osiota10/simple_shell/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osiota10%2Fsimple_shell/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269285602,"owners_count":24391301,"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","status":"online","status_checked_at":"2025-08-07T02:00:09.698Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["bash","c","linux","posix","shell","shell-scripts","syscall","unix"],"created_at":"2025-02-20T15:20:26.293Z","updated_at":"2026-04-12T18:21:58.374Z","avatar_url":"https://github.com/osiota10.png","language":"C","readme":"# 0x16. C - Simple Shell\n\n## Requirements\n### General\n- Allowed editors: `vi`, `vim`, `emacs`\n- All your files will be compiled on Ubuntu 20.04 LTS using `gcc`, using the options `-Wall -Werror -Wextra -pedantic -std=gnu89`\n- All your files should end with a new line\n- A `README.md` file, at the root of the folder of the project\n- Your code should use the `Betty` style. It will be checked using [betty-style.pl](https://github.com/holbertonschool/Betty/blob/master/betty-style.pl) and [betty-doc.pl](https://github.com/holbertonschool/Betty/blob/master/betty-doc.pl)\n- Your shell should not have any memory leaks\n- No more than 5 functions per file\n- All your header files should be include guarded\n- Use system calls only when you need to ([why?](https://alx-intranet.hbtn.io/rltoken/EU7B1PTSy14INnZEShpobQ))\n- Write a `README` with the description of your project\n- You should have an `AUTHORS` file at the root of your repository, listing all individuals having contributed content to the repository. Format, see [Docker](https://alx-intranet.hbtn.io/rltoken/UL8J3kgl7HBK_Z9iBL3JFg)\n\n\n## More Info\n### Output\n- Unless specified otherwise, your program **must have the exact same output as** `sh (/bin/sh)` as well as the exact same error output.\n- The only difference is when you print an error, the name of the program must be equivalent to your `argv[0]` (See below)\n\nExample of error with `sh`:\n```\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$ echo \"qwerty\" | ./hsh\n./hsh: 1: qwerty: not found\n$ echo \"qwerty\" | ./././hsh\n./././hsh: 1: qwerty: not found\n$\n```\n\n## List of allowed functions and system calls\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- `getpid` (man 2 getpid)\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## Compilation\nYour shell will be compiled this way:\n```\ngcc -Wall -Werror -Wextra -pedantic -std=gnu89 *.c -o hsh\n```\n\n## Testing\nYour shell should work like this in interactive mode:\n```\n$ ./hsh\n($) /bin/ls\nhsh main.c shell.c\n($)\n($) exit\n$\n```\n\nBut also in non-interactive mode:\n```\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\n## Checks\nThe Checker will be released at the end of the project (1-2 days before the deadline). We strongly encourage the entire class to work together to create a suite of checks covering both regular tests and edge cases for each task. See task `8. Test suite.`\n\n# Tasks\n### 0. Betty would be proud\nWrite a beautiful code that passes the Betty checks\n\n### 1. Simple shell 0.1\nWrite a UNIX command line interpreter.\n- Usage: `simple_shell`\n\nYour Shell should:\n- Display a prompt and wait for the user to type a command. A command line always ends with a new line.\n- The prompt is displayed again each time a command has been executed.\n- The command lines are simple, no semicolons, no pipes, no redirections or any other advanced features.\n- The command lines are made only of one word. No arguments will be passed to programs.\n- If an executable cannot be found, print an error message and display the prompt again.\n- Handle errors.\n- You have to handle the “end of file” condition (`Ctrl+D`)\n\nYou don’t have to:\n- use the PATH\n- implement built-ins\n- handle special characters : `\"`, `'`, ```, `\\`, `*`, `\u0026`, `#`\n- be able to move the cursor\n- handle commands with arguments\n\n`execve` will be the core part of your Shell, don’t forget to pass the environ to it…\n```\njulien@ubuntu:~/shell$ ./shell \n#cisfun$ ls\n./shell: No such file or directory\n#cisfun$ /bin/ls\nbarbie_j       env-main.c  exec.c  fork.c  pid.c  ppid.c    prompt   prompt.c  shell.c  stat.c         wait\nenv-environ.c  exec    fork    mypid   ppid   printenv  promptc  shell     stat test_scripting.sh  wait.c\n#cisfun$ /bin/ls -l\n./shell: No such file or directory\n#cisfun$ ^[[D^[[D^[[D\n./shell: No such file or directory\n#cisfun$ ^[[C^[[C^[[C^[[C\n./shell: No such file or directory\n#cisfun$ exit\n./shell: No such file or directory\n#cisfun$ ^C\njulien@ubuntu:~/shell$ echo \"/bin/ls\" | ./shell\nbarbie_j       env-main.c  exec.c  fork.c  pid.c  ppid.c    prompt   prompt.c  shell.c  stat.c         wait\nenv-environ.c  exec    fork    mypid   ppid   printenv  promptc  shell     stat test_scripting.sh  wait.c\n#cisfun$ julien@ubuntu:~/shell$\n```\n\n### 2. Simple shell 0.2\nSimple shell 0.1 +\n- Handle command lines with arguments\n\n### 3. Simple shell 0.3\nSimple shell 0.2 +\n- Handle the `PATH`\n- `fork` must not be called if the command doesn’t exist\n\n```\njulien@ubuntu:~/shell$ ./shell_0.3\n:) /bin/ls\nbarbie_j       env-main.c  exec.c  fork.c  pid.c  ppid.c    prompt   prompt.c  shell_0.3  stat    test_scripting.sh  wait.c\nenv-environ.c  exec    fork    mypid   ppid   printenv  promptc  shell     shell.c    stat.c  wait\n:) ls\nbarbie_j       env-main.c  exec.c  fork.c  pid.c  ppid.c    prompt   prompt.c  shell_0.3  stat    test_scripting.sh  wait.c\nenv-environ.c  exec    fork    mypid   ppid   printenv  promptc  shell     shell.c    stat.c  wait\n:) ls -l /tmp \ntotal 20\n-rw------- 1 julien julien    0 Dec  5 12:09 config-err-aAMZrR\ndrwx------ 3 root   root   4096 Dec  5 12:09 systemd-private-062a0eca7f2a44349733e78cb4abdff4-colord.service-V7DUzr\ndrwx------ 3 root   root   4096 Dec  5 12:09 systemd-private-062a0eca7f2a44349733e78cb4abdff4-rtkit-daemon.service-ANGvoV\ndrwx------ 3 root   root   4096 Dec  5 12:07 systemd-private-062a0eca7f2a44349733e78cb4abdff4-systemd-timesyncd.service-CdXUtH\n-rw-rw-r-- 1 julien julien    0 Dec  5 12:09 unity_support_test.0\n:) ^C\njulien@ubuntu:~/shell$\n```\n\n### 4. Simple shell 0.4\nSimple shell 0.3 +\n- Implement the `exit` built-in, that exits the shell\n- Usage: `exit`\n- You don’t have to handle any argument to the built-in `exit`\n\n### 5. Simple shell 1.0\nSimple shell 0.4 +\n- Implement the `env` **built-in**, that prints the current environment\n\n```\njulien@ubuntu:~/shell$ ./simple_shell\n$ env\nUSER=julien\nLANGUAGE=en_US\nSESSION=ubuntu\nCOMPIZ_CONFIG_PROFILE=ubuntu\nSHLVL=1\nHOME=/home/julien\nC_IS=Fun_:)\nDESKTOP_SESSION=ubuntu\nLOGNAME=julien\nTERM=xterm-256color\nPATH=/home/julien/bin:/home/julien/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin\nDISPLAY=:0\n$ exit\njulien@ubuntu:~/shell$ \n```\n\n\n## Collaborators \n- Fahad Sarki Mukhtar \u003cfahads.mukhtar@gmail.com\u003e\n- Osiota Samuel Obrozie \u003cosiotaobrozie@gmail.com\u003e\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosiota10%2Fsimple_shell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosiota10%2Fsimple_shell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosiota10%2Fsimple_shell/lists"}