Mini shell made in C for Linux using GNU Readline Library
Table of Contents
- Inspired by Cornell's CS 414's Shell assignment, this project aims to create a shell in C, much like Csh or Bash
- Implements various advanced programming techniques such as process creation and control, file descriptors, signals, I/O redirection and pipelines
- Takes in a list of commands separated by space or pipes and parses it into individual components such as commands, flags, I/O files, pipe and I/O operators
- Shell prompt displays the user's present working directory, user login info and their host machine name
- Final results can be neatly saved in a CSV format.
- Features 5 built-in commands: cd, history, jobs, kill and exit
- Caches user commands using GNU Readline/History library
- Allows users to create background jobs by using the '&' operator and display them with their process IDs using the 'jobs' command
- Background jobs can be killed using 'kill' command followed by the process ID of the job
- Dynamic analysis tools such as Valgrind was used to detect and subsequently fix memory leaks
- GNU Readline Library
You can install the GNU Readline library GNU Readline library using the following command
sudo apt-get install libreadline6 libreadline6-dev
- Automatically compile the project using make,
make
- Then run using the shell by using the following command,
./shell
-
Go to the specified directory:
cd [path/to/directory]
-
View jobs spawned by the current shell:
jobs
-
Display the commands history list:
history
-
Kill a background job:
kill [process_id]
-
Exit the shell:
exit
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.md
for more information.