This is a simple shell written in C++ from scratch. It supports various shell-like features including command execution, piping, background processes, and I/O redirection.
- Execute Commands: Run standard system commands.
- Change Directory (
cd
): Navigate between directories. - Help Command (
help
): Display available commands. - Background Execution (
&
): Run processes in the background. - Check Background Processes (
checkbg
): View running background jobs. - Piping (
|
): Connect commands using pipes. - I/O Redirection (
>
and>>
): Redirect command output to files.
- C++ Compiler (G++ recommended)
- Make (for compilation automation)
To compile the shell, use the provided Makefile:
make
This generates the executable shell
.
After compilation, run the shell with:
./shell
To remove compiled files, run:
make clean
You can run any system command just like in a normal shell:
ls
pwd
echo "Hello, World!"
cd <directory>
Example:
cd /home/user
Run a command in the background by appending &
:
top &
Use checkbg
to view background processes:
checkbg
Use |
to pass the output of one command as input to another:
ls | grep .cpp
- Overwrite file output:
echo "Hello" > file.txt
- Append to a file:
echo "Hello Again" >> file.txt
Run:
help