https://github.com/kaustubhhiware/cshell
A basic shell. Written in C
https://github.com/kaustubhhiware/cshell
c cat cshell linux shell
Last synced: about 1 year ago
JSON representation
A basic shell. Written in C
- Host: GitHub
- URL: https://github.com/kaustubhhiware/cshell
- Owner: kaustubhhiware
- License: mit
- Created: 2017-01-25T18:49:33.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-02-01T10:15:39.000Z (over 8 years ago)
- Last Synced: 2025-03-30T11:11:50.178Z (about 1 year ago)
- Topics: c, cat, cshell, linux, shell
- Language: C
- Size: 268 KB
- Stars: 24
- Watchers: 1
- Forks: 15
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cshell
A shell implemented in C. Written as a part of Operating Systems (CS39002) coursework.

## Functionalities
The following functions have been written explicitly in C.
* **cd** - Change directory
* **pwd** - Present Working directory
* **mkdir ** - Make a directory (Alerts if already exists)
* **rmdir ** - Remove the directory (Alerts if no such file or directory)
* **ls** - List contents of pwd

* **ls -l** - List the contents in long listing format

* **cp ** - Copy contents of file1 to file2; only if file1 was more recently modified. Create file2 if not present already.
* **exit** - Exit the shell ; also works for **z**
* Supports running the **execuables** (predominanatly, ./a.out and scripting commands, like touch, cat, python notif.py )
* Any path added to your `$PATH` folder will work. [Refer to function runprocess in shell.c]
* Support background execution such as `python notif.py &` - returns its PID.
* Input from and output to files, such as `./d < in.txt` and `./inc > in.txt` supported. (Both can work simultaneously.)
* Support piping upto 2 levels - such as `./inc | ./d` and `./inc | ./d | ./t `
## Execution
make clean
make
./Cshell
Output :

The test cases are present in [tests](tests/) folder.
`run.c` creates a child process to execute `shell.c` in a gnome-terminal, suited for debuggging. In case the terminal session is to be viewed in the continuing session, execution is as :
make clean
make
./myshell
## Known issues
* `gcc` and `grep` don't work for some freaking reason. Most of the other commands like cat, touc, gedit, atom work but these 2 seem to hold a grudge against me.
* support piping with system calls.