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:
makeThis generates the executable shell.
After compilation, run the shell with:
./shellTo remove compiled files, run:
make cleanYou can run any system command just like in a normal shell:
ls
pwd
echo "Hello, World!"cd <directory>Example:
cd /home/userRun a command in the background by appending &:
top &Use checkbg to view background processes:
checkbgUse | 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