#shell-terminal #shell #bash #posix

app trsh-rs

Attempt to create a posix shell in rust

2 releases

Uses new Rust 2024

new 0.0.2 Apr 2, 2025
0.0.1 Mar 29, 2025

#397 in Command line utilities

Download history 101/week @ 2025-03-25

101 downloads per month

MIT license

47KB
1K SLoC

Trsh

its uh.. its a rust shell

todo: aliases variable expansion .trshrc redirection pipelines

trsh Development Roadmap

For most of these, take them as a very loose interpretation of "Complete". Until I start digging into phase 5 I don't think I'll worry much about complete end to end testing. So it's mostly just "This works for a few of the commands I tried with it"

Phase 1: Core (done or nearly done)

  • REPL w/ prompt
  • Command parsing
  • Builtin detection
  • Builtins: cd, pwd, alias, unalias, export, unset, exit
  • SIMPLE .trshrc support
  • -c [script_file]

Phase 2: (Simple) Execution Semantics + (Simple) Control Flow

  • Append (Redirection): >>
  • Truncate (Redirection): >
  • HereDoc (Redirection): <<
  • Input (Redirection): <
  • Pipes
  • Command Sequencing
  • Conditionals (if, then, else, fi)
  • Conditionals (with test/ [)
  • Logic: Ands (&&), ors (||)

Phase 3: Shell Language Features

  • Variable Expansion $VAR
  • loops (while, for)
  • Command Sub $(...)
  • Comprehensive Quote Handling

Phase 4: POSIX Compatibility & Testability

  • arithmetic sub $((...))
  • Incorporate POSIX compat testing
  • Start polish/comprehensive testing
  • Ensure correctness of exit codes
  • Script-local scoping
  • History and Job Control

Phase 5: Stretch

  • functions
  • grouping
  • $1 things for function args
  • subshells
  • i/o redir w/ FD
  • !, history, things like that
  • plugins?

Dependencies

~7–15MB
~191K SLoC