/bensh

A shell written with my common use cases in mind.

Primary LanguageC++MIT LicenseMIT

BenSH - Ben's Shell

A shell written with my common use cases in mind.

This project was heavily inspired by indradhanush's blog post on shells and the Build Your Own X project.

Features

  • Run any command on PATH.
  • exit
  • cd
  • Find new and interesting bugs 😅

Known Bugs 🐛 🪲 🦗

To Do

  • Add shell scripting
  • Add configuration files
  • Add pipes and I/O redirection
  • Add history command
  • Add info command
  • Add up and down arrow history movement
  • Add left and right arrow comamnd editing
  • Fix prompt bug (#1)

Design

graph TD
    A[Shell Starts] --> B(Adjust terminal settings)
    B --> C(Show prompt)
    C --> D(User types input)
    D --> E(Check for interupt)
    E -->|Interupt| F(Handle interupt)
    E -->|No Interupt| G(Validate command)
    F --> C
    G -->|Exit Command| I(Restore terminal settings)
    G -->|Cd command| K(Change working directory)
    K --> C
    I --> J(Exit)
    G -->|Valid Command| H(Fork & execute)
    G -->|Invalid Command| C
    H --> C