Skip to main content

Unix Shell written in Python3

Project description

🐍 SnakeShell: A Bash-like Unix Shell in Python

License Python Contributions Welcome

Welcome to SnakeShell! 🎉

This project aims to develop a Unix shell similar to Bash, written in Python and utilizing the PEG parser TatSu. SnakeShell is designed to replicate core functionalities of traditional Unix shells while incorporating modern features.

📚 Table of Contents

🌟 Features

  • Process Management: Forking, executing, and waiting for processes
  • File Redirection and Pipes: Input/output redirection and command pipelines
  • Job Control: Background processes and signal handling
  • Quoting and Expansion: Variable expansion and globbing
  • Interactive Features: Command history and auto-completion

📋 Roadmap

Development Stages

Stage 1: Fork/Exec/Wait ✅

  • Basics of Unix processes
  • Implement the simplest possible shell
  • Support built-in commands like cd, exec, etc.
  • Search for commands in PATH
  • Handle exit statuses and the ! operator
  • Support command lists using ;, &&, and ||
  • Support subshells and line continuation

Stage 2: Files and Pipes ✅

  • Implement file descriptor redirection (<, >, >>, <>)
  • Support pipes between commands (|)
  • Handle file descriptor duplication (<&, >&)
  • Implement process and command substitution (<(...), $(...))
  • Ensure proper handling of file descriptors and inheritance

Stage 3: Job Control and Signals 🚧

  • Discuss signals and support for keyboard shortcuts like Ctrl+C, Ctrl+\, and Ctrl+Z
  • Implement background processes and job control (&, jobs, fg, bg)
  • Ensure proper handling of sessions and process groups

Stage 4: Quoting and Expansion ⏳

  • Handle environments and variables
  • Implement globbing (wildcard matching)
  • Support quoting and character escaping
  • Handle alias and function expansions

Stage 5: Interactivity ⏳

  • Enhance the shell for interactive work
  • Support command history
  • Implement auto-completion
  • Customize prompts and themes

🚀 Installation

To install SnakeShell, follow these steps:

  1. Clone the repository

    git clone https://github.com/G000D1ESS/snakeshell.git
    
  2. Navigate to the project directory

    cd snakeshell
    
  3. Run the installation

    python3 -m pip install .
    

🎮 Usage

To use this Unix Shell, follow these steps:

  1. Start the shell by executing the command:

    snake
    
  2. Enter commands in the interactive shell and press Enter to execute them.

    Example commands:

    ls -l
    cd /path/to/directory
    mkdir new_directory
    

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


Feel free to ⭐ star the repository if you find it interesting!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cobrashell-0.0.2.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

cobrashell-0.0.2-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file cobrashell-0.0.2.tar.gz.

File metadata

  • Download URL: cobrashell-0.0.2.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.6 Darwin/23.6.0

File hashes

Hashes for cobrashell-0.0.2.tar.gz
Algorithm Hash digest
SHA256 6a9f49e1710294cec3e86903178fe02ed4eec220a4f407846f4e59993ce802a0
MD5 e9b9e8541224dccc6e3ed4772d354e24
BLAKE2b-256 664b158ff9251e986a280671d7a8b7c216edc8e599920e5ff3c6f68c0d666e32

See more details on using hashes here.

File details

Details for the file cobrashell-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: cobrashell-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.6 Darwin/23.6.0

File hashes

Hashes for cobrashell-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d72ac2e6ad1dd5b5cb7a89ee2bc489bafdb48fae9a70c9ad0f41a31c4a38ca33
MD5 131bda83340fc4608f2a22699d94c93b
BLAKE2b-256 fb896e2addafb7ce10d82edc9c71a8112d44d4641f978da98c2e6450a5fa5e35

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page