An open API service indexing awesome lists of open source software.

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.

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.