A minimal Unix-like shell supporting command execution, piping, redirections, background execution, and command history.
This project is a custom Unix shell implementation that supports various shell functionalities, including command execution, piping, redirections, background execution, logical operators, and command history.
- Supports execution of external programs (e.g.,
ls,pwd,echo,whoami,cd).
- Output Redirection (
>): Redirects command output to a file:echo "Hello" > file.txt
- Append Mode (
>>): Appends output to a file instead of overwriting:echo "Hello again" >> file.txt
- Input Redirection (
<): Uses a file as input for a command:cat < file.txt
- Allows connecting multiple commands by passing output from one command as input to another:
ls | wc -l
- Enables running commands in the background without blocking the shell:
sleep 5 & - Displays the process ID (
PID) of background processes.
- AND (
&&): Executes the second command only if the first one succeeds:ls && echo "Success"
- OR (
||): Executes the second command only if the first one fails:ls nonexistent || echo "Failed"
- Allows executing previous commands using
!n, wherenis the command number:!1 # Executes the first command in history
gcc sh.c -o utsh./utshutsh$ ls
utsh$ pwd
utsh$ echo "Hello, Shell!"
utsh$ ls | wc -l
utsh$ echo "Output" > output.txt
utsh$ cat < output.txt
utsh$ sleep 5 &
utsh$ ls && echo "Command successful"
utsh$ ls nonexistent || echo "Command failed"
utsh$ !1 # Executes the first command in history- This shell does not support advanced features like job control (
fg,bg,kill). - It assumes valid input formats and does not handle deeply nested piping.
This project is developed as part of CS5460/6460 Operating Systems Assignment.
Developed by Abhijeet Pachpute 😎
