https://github.com/scar027/basic-shell
Basic unix shell implemented by following the tutorial by Stephen Brennan with some additional features and tweaks.
https://github.com/scar027/basic-shell
c os shell unix unix-shell
Last synced: 2 months ago
JSON representation
Basic unix shell implemented by following the tutorial by Stephen Brennan with some additional features and tweaks.
- Host: GitHub
- URL: https://github.com/scar027/basic-shell
- Owner: scar027
- License: mit
- Created: 2025-06-14T05:26:19.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-14T06:09:53.000Z (about 1 year ago)
- Last Synced: 2025-06-14T06:26:55.273Z (about 1 year ago)
- Topics: c, os, shell, unix, unix-shell
- Language: C
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# basic-shell
Basic unix shell implemented by following the [tutorial by Stephen Brennan](https://brennan.io/2015/01/16/write-a-shell-in-c/) with some additional features and tweaks.
## Compile and run
Compile and run the source code from the project directory after cloning.
```
gcc -o shell.out shell.c -Wall
./shell.out
```
## Additional Functionality
Some features added over the existing implementation from the tutorial are as follows:
1. Background process execution using `&` and management using additional helper functions and `sigchld_handler()`.
2. Properly terminate background processes on calling `exit()` to avoid zombie processes and ensure clean resource reclamation.
## Tweaks
Some changes compared to the original implementation of the tutorial:
1. Some additional error handling checks in the `launch()` function consistent with the documentation from the `man 2 wait` page.
2. Green colour for prompts.