Welcome to my solution for the "Build Your Own Shell" Challenge by Codecrafters! 🚀
In this challenge, I've implemented a POSIX-compliant shell capable of interpreting shell commands, executing external programs, and handling built-in commands like cd, pwd, and echo. This project dives deep into concepts like shell command parsing, REPLs (Read-Eval-Print Loops), and the mechanics of how a shell interacts with the operating system. It's been a fantastic way to explore Go's standard library while building something practical.
Note: If you're viewing this repo on GitHub, check out codecrafters.io to try the challenge yourself!
- Go 1.19 or later installed on your system.
- A Unix-like environment (Linux or macOS). For Windows, use WSL or a compatible terminal emulator.
- Clone this repository:
git clone https://github.com/your-username/codecrafters-shell.git cd codecrafters-shell - Run the shell program:
./your_program.sh
- Start entering shell commands:
$ echo "Hello, Shell!" Hello, Shell!
- To exit the shell, use:
exit
- The shell is implemented as a REPL in Go.
- Commands are read from standard input, parsed into components (handling quotes and escape sequences), and executed either as built-in or external commands.
- Key features implemented:
- Built-in Commands: Includes
cd,pwd,echo, etc. - Quoting Support: Handles single quotes, double quotes, and backslashes.
- External Command Execution: Uses Go's
os/execpackage to run external programs.
- Built-in Commands: Includes
This implementation follows the stages outlined in the Codecrafters challenge:
- Stage 1: Basic shell functionality (REPL setup and external command execution).
- Stage 2: Support for built-in commands like
echo,cd, andpwd. - Stage 3 and Beyond: Advanced features like quoting, backslash handling, and argument parsing.
Follow the progress banner at the top to see how far this project has come!