https://github.com/md-talim/shell-cpp
POSIX compliant shell that's capable of interpreting shell commands, running external programs and builtin commands like cd, pwd, echo and more.
https://github.com/md-talim/shell-cpp
build-your-own-x cpp shell
Last synced: about 1 year ago
JSON representation
POSIX compliant shell that's capable of interpreting shell commands, running external programs and builtin commands like cd, pwd, echo and more.
- Host: GitHub
- URL: https://github.com/md-talim/shell-cpp
- Owner: Md-Talim
- Created: 2024-12-08T03:52:26.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-08T02:33:59.000Z (over 1 year ago)
- Last Synced: 2025-02-08T03:23:18.728Z (over 1 year ago)
- Topics: build-your-own-x, cpp, shell
- Language: C++
- Homepage:
- Size: 42 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# My Own Shell in C++
[](https://app.codecrafters.io/users/codecrafters-bot?r=2qF)
This repository contains the code for a POSIX-compliant shell written in C++. This project is part of the ["Build Your Own Shell"](https://app.codecrafters.io/courses/shell/overview) Challenge on CodeCrafters.
## Overview
This shell can interpret shell commands, run external programs, and handle built-in commands like `cd`, `pwd`, `echo`, and more. It includes features such as command parsing, REPL (Read-Eval-Print Loop), and built-in commands. Future updates will include support for output redirection and autocompletion.
## Project Structure
- **`.codecrafters/`**: Contains scripts for compiling and running your program on CodeCrafters.
- **`.vscode/`**: Contains Visual Studio Code settings.
- **`build/`**: Directory where the build files are generated.
- **`include/`**: Contains header files.
- **`src/`**: Contains the source code for the shell and its utilities.
- **`CMakeLists.txt`**: CMake configuration file.
- **`codecrafters.yml`**: Configuration file for CodeCrafters.
- **`your_program.sh`**: Script to run your program locally.
## Getting Started
### Prerequisites
- Ensure you have `cmake` installed locally.
- Ensure you have `vcpkg` installed and configured.
### Building the Project
To build the project, run the following command:
```sh
./your_program.sh
```
This script will compile the project using CMake and build the executable.
### Running the Shell
To run the shell, execute the following command:
```sh
./build/shell
```
This will start the shell, and you can begin entering commands.
## Built-in Commands
The shell supports the following built-in commands:
| Command | Description |
|------------------|--------------------------------------------|
| `cd ` | Change the current directory. |
| `pwd` | Print the current working directory. |
| `echo ` | Print the text to the standard output. |
| `type ` | Display information about the command. |
| `exit` | Exit the shell. |
## External Commands
The shell can also execute external commands found in the system's `PATH`.
## Acknowledgements
This project is part of the CodeCrafters "Build Your Own Shell" Challenge. Special thanks to the CodeCrafters team for providing the challenge and resources.