Tiny Shell (tsh) is a minimal shell implementation designed to support basic shell functionality, including executing built-in commands, handling user input, and managing processes. This project is an educational exercise to understand how shells work at the system level.
- Prompt Display: Displays a custom prompt (
tsh>) to take user commands. - Built-in Commands:
cd <directory>: Change the current working directory.exit: Exit the shell.help: Display information about the shell.
- Process Execution: Supports running external programs.
- Background Processes: Supports running processes in the background using
&. - Signal Handling: Gracefully handles
SIGINT(Ctrl+C) and other signals. - Error Handling: Handles invalid commands and arguments gracefully.
- sdriver.pl : The trace-driven shell driver
- trace*.txt : The 17 trace files that control the shell driver
- tshref.out : Example output of the reference shell on all 17 traces
- myspin.c : Takes argument and spins for seconds
- mysplit.c : Forks a child that spins for seconds
- mystop.c : Spins for seconds and sends SIGTSTP to itself
- myint.c : Spins for seconds and sends SIGINT to itself
- GCC or any C compiler
- Linux or macOS environment (not tested on Windows)
- Make utility
make./tsh- Launch the Shell: Run
./tshto start the Tiny Shell. The shell prompt will appear astsh>. - Execute Commands:
- To run a command in the foreground:
tsh> ls -l - To run a command in the background:
tsh> sleep 10 &
- Built-in Commands:
- Quit the Shell:
tsh> exit
Contributions are welcome! Feel free to submit issues or pull requests to improve this program.
This project is licensed under the MIT License. See LICENSE file for details.