https://github.com/dtg-lucifer/rust-shell
A basic shell with some basic commands made with rust to understand the language
https://github.com/dtg-lucifer/rust-shell
codecrafters rust shell
Last synced: 2 months ago
JSON representation
A basic shell with some basic commands made with rust to understand the language
- Host: GitHub
- URL: https://github.com/dtg-lucifer/rust-shell
- Owner: dtg-lucifer
- Created: 2025-03-18T08:13:36.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-03-18T10:51:10.000Z (over 1 year ago)
- Last Synced: 2025-03-18T11:39:38.598Z (over 1 year ago)
- Topics: codecrafters, rust, shell
- Language: Rust
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rust Shell Implementation
[](https://app.codecrafters.io/courses/shell/overview)
A lightweight POSIX-compliant shell written in Rust, built as part of the "Build Your Own Shell" challenge from Codecrafters.
## 📋 Features
- Command execution from PATH locations
- Built-in commands:
- `cd` - Change directory
- `pwd` - Print current working directory
- `echo` - Display text
- `type` - Display command type information
- Custom executable support
- Interactive command prompt
## 🚀 Getting Started
### Prerequisites
- Rust 1.80 or higher
- Cargo 1.82 or higher
### Installation
Clone this repository:
```bash
git clone https://github.com/dtg-lucifer/rust-shell.git
cd rust-shell
```
### Running the Shell
Build and run the shell:
```bash
cargo run
```
## 🧰 Project Structure
```
src/
├── main.rs # Entry point
└── cmd/ # Command modules
├── mod.rs # Module definitions
├── cd.rs # cd builtin command
├── command.rs # Command handling
├── custom_exe.rs # Custom executable handling
├── echo.rs # echo builtin command
├── pwd.rs # pwd builtin command
└── type_cmd.rs # type builtin command
```
## 🤓 How It Works
The shell provides a simple REPL (Read-Evaluate-Print Loop) interface:
1. Displays a prompt (`$`)
2. Reads user input
3. Parses the command and arguments
4. Executes the appropriate built-in command or external program
5. Returns to step 1
External commands are searched in the directories specified in the PATH environment variable.
## 🔧 Development
To contribute or modify:
1. Make your changes
2. Run tests: `cargo test`
3. Build: `cargo build`
## 📄 License
This project is available under the [MIT License](LICENSE).
## 🙏 Acknowledgements
- [Codecrafters](https://codecrafters.io) for the shell implementation challenge