For this project, I've developed a minimalistic shell that mirrors core functionalities of renowned shells like bash. While most on this platform are likely familiar with the concept, for context, a shell serves as a command-line interface in Unix-like operating systems, enabling users to run commands, traverse directories, oversee processes, and more.
- Prompt Execution: Provides a prompt for users to input and execute commands.
- Blank Line & Comments Handling: Efficiently handles blank lines and supports comment lines that start with a '#'.
- Variable Expansion: Supports expansion for variables using '&&'.
- Built-in Commands: Incorporates code directly into the shell to execute commands like 'exit', 'cd', and 'status'.
- Command Execution: Uses the exec family of functions to execute all other commands.
- Input & Output Redirection: Fully supports redirecting command inputs and outputs.
- Foreground & Background Processes: Allows commands to run both in the foreground and background.
- Custom Signal Handlers: Implemented custom signal handlers to manage signals such as SIGINT and SIGTSTP.
To compile and run the shell, use the following commands:
gcc -std=gnu99 -pthread -o smallsh smallsh.c
./smallsh