A custom, basic Unix shell implementation written in C++ (C++23).
This shell provides a basic command-line interface with support for several built-in commands and the ability to execute external programs found in your system's $PATH.
-
Built-in Commands:
exit: Exits the shell.echo: Prints text to the standard output. Handles single quotes ('), double quotes ("), and escape characters (\).pwd: Prints the current working directory.cd: Changes the current directory. Supportscd ~(home directory),cd -(previous directory), and standard paths.type: Indicates how a command name would be interpreted (e.g., shell builtin or an external executable path).
-
External Command Execution:
- Executes any valid command found in the directories listed in the
$PATHenvironment variable.
- Executes any valid command found in the directories listed in the
-
I/O Redirection:
>or1>: Redirect standard output to a file (overwrite).>>or1>>: Redirect standard output to a file (append).2>: Redirect standard error to a file (overwrite).2>>: Redirect standard error to a file (append).
To compile the shell, you need a C++ compiler that supports C++23 (like g++).
Run the following command in the project root:
makeThis will compile src/main.cpp and generate an executable named shell.
After building, you can start the shell by running:
./shellYou will be greeted with the $ prompt, ready to accept your commands.
To remove the compiled executable, run:
make clean