HeadlinesBriefing favicon HeadlinesBriefing.com

Rubish Brings Full Bash Compatibility to Pure Ruby Shell

Hacker News •
×

Rubish introduces a Unix shell implemented entirely in Ruby, compiling shell syntax directly to Ruby code for execution by the Ruby VM. The project achieves full Bash compatibility, allowing existing bash scripts to run unmodified while treating any incompatibilities as bugs requiring fixes.

Beyond compatibility, Rubish deeply integrates Ruby's language features into shell scripting. Developers can use Ruby blocks, iterators, and libraries directly in shell scripts, with method call syntax like `ls('-la')` instead of traditional `ls -la` formatting. The shell supports Ruby conditions, method chaining, and inline Ruby evaluation for complex operations.

Advanced capabilities include lazy loading for slow shell initializations, restricted mode for secure script execution, and a public API for embedding Rubish in other Ruby applications. The shell loads configuration from standard locations and supports custom prompts with dynamic content like git branch information.

Installation happens via Homebrew on macOS or by building from source, with a bundled launcher that detects available Ruby installations. This approach eliminates the fork+exec overhead typical of shell implementations while maintaining compatibility with existing shell ecosystems.