This repository contains my implementation of a shell as part of the CodeCrafters.io Shell Challenge. Built entirely in Rust, this shell replicates basic Unix shell functionalities.
cd
: Change the current working directory.pwd
: Display the current working directory.echo
: Print arguments to the standard output.type
: Display whether a command is a built-in or an external executable.exit
: Terminate the shell.
- Seamlessly runs external binaries available in the system PATH.
- Displays standard output and standard error from commands.
- Handles relative paths, absolute paths, and home directory shortcuts (
~
). - Ensures proper context management for path changes and directory traversal.
- Maintains state for executables and the current working directory.
- Dynamically updates the list of available executables from the system PATH.
- Supports handling single and double-quoted strings.
- Escapes special characters in commands where appropriate.
- Add support for I/O redirection (e.g.,
>
,<
,>>
). - Implement piping (e.g.,
command1 | command2
). - Add tab-completion for commands and file paths.
- Support environment variable management (e.g.,
export
,unset
).
- Add a history feature to navigate previous commands.
- Add unit and integration tests for core functionalities.
- Optimize performance for large or complex commands.
-
Clone this repository:
git clone https://github.com/omagdy7/tiny-shell cd tiny-shell
-
Build and run the project:
cargo run --release
Special thanks to CodeCrafters.io for designing this challenge and providing an engaging platform for learning system-level programming.