A simple Unix shell written in C that supports both interactive and non-interactive modes. It can execute a variety of commands, handle signals, and more.
- Interactive Mode: Run the shell interactively, accepting user commands in real-time.
- Non-Interactive Mode: Execute commands from a pipe (file and script support coming soon).
- Command Execution: Supports a variety of Unix commands.
- Signal Handling: Properly handles signals to ensure robust execution.
- This shell requires a Unix-like operating system.
- You'd need a C compiler, preferably gcc.
Clone the repository
git clone https://github.com/Tonie-NG/simple_shell.git
Change directory to the project:
cd simple_shell
Compile the shell using the following command:
gcc *.c -o simple_shell
For more strictness, you could use this:
gcc -Wall -Werror -Wextra -pedantic -std=gnu89 *.c -o simple_shell
- Interactive Mode:
Simply run the executable, and the shell will start accepting commands.
./simple_shell
- Non-Interactive Mode:
Provide a valid command using echo and pipe it to the executable file.
echo "/bin/ls" | ./simple_shell
- Interactive Mode:
To start the shell:
./simple_shell
Provide the command path:
/bin/ls
/bin/ls -l
You can also provide the command, and the shell handles the full path:
ls
pwd
exit
- Non-interactive mode:
Provide the command path via pipe:
echo "/bin/ls" | ./simple_shell
Provide the command and the shell handles the path
echo "ls" | ./simple_shell