https://github.com/shubhamsharma0711/custom-unix-linux-shell
Custom Unix/Linux Shell, I developed as part of an Operating Systems course Assignment at IIITD. All Commands are implemented using both the fork system call and pthreads.
https://github.com/shubhamsharma0711/custom-unix-linux-shell
c cse231 cse231-iiitd custom-shell execvp fork iiitd linux-shell os os-assignment shell shell-assignment thread unix-shell
Last synced: about 1 month ago
JSON representation
Custom Unix/Linux Shell, I developed as part of an Operating Systems course Assignment at IIITD. All Commands are implemented using both the fork system call and pthreads.
- Host: GitHub
- URL: https://github.com/shubhamsharma0711/custom-unix-linux-shell
- Owner: SHUBHAMSHARMA0711
- Created: 2023-05-16T13:26:36.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-01-23T15:15:13.000Z (over 2 years ago)
- Last Synced: 2025-09-11T11:55:33.170Z (9 months ago)
- Topics: c, cse231, cse231-iiitd, custom-shell, execvp, fork, iiitd, linux-shell, os, os-assignment, shell, shell-assignment, thread, unix-shell
- Language: C
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Shell Description
This comprehensive overview provides details on external and internal commands implemented in the shell, along with error-handling mechanisms. Additionally, test cases and assumptions are outlined to guide users in utilizing the shell effectively.
## External Commands
### 1. ls
- ls -a
- ls -m
### 2. cat
- cat -n
- cat -E
### 3. date
- date -u
- date -I
### 4. rm
- rm -v
- rm -i
### 5. mkdir
- mkdir -p
- mkdir -v
## Internal Commands
### 1. cd
- cd ~
- cd ..
### 2. echo
- echo *
- echo --help
### 3. pwd
- pwd -L
- pwd -P
## Error Handling
1. **Command Not Found:** If the user enters any command other than the specified ones.
2. **No Such File or Directory:** In **cat** and **rm** commands for non-existing files, and in **cd** for non-existing directories.
3. **Invalid Option:** If the user enters an option not handled by the shell.
4. **Missing Operands:** In **cat** if the user enters it without any argument.
5. **Cannot Create Directory:** In **mkdir** if the user tries to create a duplicate directory.
6. **Fork Error (Child Process Not Created):** Error handling for creating a child process using the Fork System Call.
## Implementation Details
The shell can be implemented using both forks and threads. If someone wishes to use threads, they can add `&t` at the end of the command. For example:
- `ls -a &t`
- `cat -n cat.c &t`
- `date -I &t`
## Test Cases
### 1. ls
- `ls -a` & `ls -a &t`
- `ls -m` & `ls -m &t`
### 2. cat
- `cat -n cat.c` & `cat -n cat.c &t`
- `cat -E cat.c` & `cat -E cat.c &t`
### 3. date
- `date -u` & `date -u &t`
- `date -I` & `date -I &t`
### 4. rm hello.c
- `rm -v hello.c` & `rm -v hello.c &t`
- `rm -i hello.c` & `rm -i hello.c &t`
### 5. mkdir newDir
- `mkdir -p newDir/newDir2` & `mkdir -p newDir/newDir2 &t`
- `mkdir -v newDir` & `mkdir -v newDir &t`
## Assumptions
1. No unnecessary arguments will be passed in between or after the command.
2. **cat** and **rm** commands will not be passed a directory as an argument.
3. **mkdir** and **rm** commands will not be entered without any arguments.