Advanced Custom Shell (Version 1.
0)
1. Introduction
This project implements an Advanced Custom Shell in C++, designed to provide a modern,
feature-rich command-line experience similar to popular Unix/Linux shells. It supports command
execution, pipes, redirection, background jobs, scripting, and command history, making it a
versatile tool for interacting with the operating system.
2. Objectives
• Implement a custom shell capable of executing system commands.
• Provide modern shell features like pipes, I/O redirection, and background execution.
• Maintain command history and display it on request.
• Support script execution for automating multiple commands.
• Display information in a user-friendly format with color-coded prompts.
3. Features
Core Features:
■ Command Execution – Runs any valid Linux/Unix command using fork() and execvp().
■ Pipes (|) – Supports chaining multiple commands using pipes.
■ Input/Output Redirection (<, >, >>) – Reads input from files and redirects output.
■ Background Execution (&) – Runs processes in the background.
■ Built-in Commands: cd, pwd, history, jobs, clear, copy, script, exit/quit.
Additional Features:
■ Command History – Stores last 100 commands.
■ Background Process Management – Handles zombie processes with SIGCHLD.
■ Colored Output & Prompts – Improves user experience.
■ Script Support – Allows automation by reading commands from a file.
4. System Requirements
Software: Linux/Unix OS, g++ compiler (C++11+), POSIX terminal
Hardware: 2GB RAM, x86/x64 CPU, 10MB storage
5. Tools & Technologies Used
C++, fork(), execvp(), waitpid(), pipe(), dup2(), signal(), ANSI escape codes for colors.
6. Project Architecture
The shell is implemented as a class `AdvancedShell` with private members for history, background
processes, and ANSI color codes, and public methods like run() for execution loop.
7. Execution Flow
➡ Startup: Displays welcome banner, sets up environment.
➡ User Input: Displays prompt and waits for input.
➡ Command Processing: Adds to history, checks for built-ins, executes external commands.
➡ Output: Displays results with colors and manages background jobs.
➡ Loop: Continues until user exits.
8. Testing & Validation
Test Case Input Expected Output Status
Change Directory cd /tmp Switches to /tmp ■
Pipe Command ls | wc -l Count of files ■
Output Redirection echo hello > file.txt File contains hello ■
Background Execution sleep 5 & Runs in background ■
Show History history Displays history ■
9. Conclusion
The Advanced Custom Shell successfully demonstrates process management, piping, redirection,
and file I/O in C++. It is a robust learning project for systems programming and can be extended
with more advanced features like tab-completion, persistent history, and job control.