A lightweight, extensible shell implementation written in Python that provides core Unix-like shell functionality with built-in command support and tab completion.
- Built-in Commands: Implements essential shell commands like
cd,pwd,echo, andtype - Tab Completion: Smart context-aware tab completion for commands and file paths
- External Command Support: Seamlessly execute external system commands
- Path Resolution: Intelligent PATH-based command resolution
- Error Handling: Robust error handling for file operations and command execution
- Cross-Platform: Works on Unix-like systems and Windows
- Python 3.6 or higher
- No external dependencies required!
- Clone the repository:
git clone https://github.com/yourusername/pyshell.git
cd pyshell- Make the script executable (Unix-like systems):
chmod +x pyshell.py- Run PyShell:
./pyshell.pyOnce PyShell is running, you'll see the shell prompt $. Here are some examples of what you can do:
$ pwd # Print working directory
/home/user/projects
$ cd Documents # Change directory
$ echo Hello World # Print text
Hello World
$ type echo # Check command type
echo is a shell builtin
$ ls # Run external commands
file1.txt file2.txt| Command | Description |
|---|---|
cd [dir] |
Change current directory (defaults to home directory if no argument) |
pwd |
Print working directory |
echo [text...] |
Print text to standard output |
type [command] |
Display command type (builtin or external) |
exit [code] |
Exit shell with optional status code |
PyShell is built with a modular, object-oriented design:
Shell: Main shell class handling input processing and command executionShellCommand: Abstract base class for all built-in commandsPathResolver: Handles command path resolution using system PATHCompleter: Provides context-aware tab completion functionality
Contributions are welcome! Here are some ways you can contribute:
- 🐛 Report bugs
- 🎈 Request features
- 📝 Submit pull requests
- 📖 Improve documentation
This project is licensed under the MIT License - see the LICENSE file for details.
- Command history support
- Pipeline implementation
- Environment variable management
- Shell scripting support
- Alias support
- More built-in commands
If you have any questions or suggestions, feel free to open an issue or reach out directly.
Made with ❤️ using Python