Rubish: A Unix shell written in pure Ruby
AIThis post was created with the assistance of artificial intelligence (AI).

TL;DR

Prime Big Deal Days · Oct 6–7Offer from Amazon

Get the latest gadgets delivered free — and shop member deals

  • Fast, free delivery on millions of items
  • Access to Prime Big Deal Days deals on October 6–7
  • Prime Video, Amazon Music and more included
Start your free Prime trial Free trial for eligible customers · Cancel anytime
As an affiliate, we earn on qualifying purchases.

Rubish is a Unix shell written entirely in Ruby that supports Bash syntax and features. It allows running existing Bash scripts and seamlessly integrates Ruby code, offering a new way to combine shell scripting with Ruby’s capabilities. This development could impact scripting workflows and Ruby-based system automation.

Rubish, a Unix shell fully written in Ruby, has been released with full Bash compatibility and deep Ruby integration, allowing users to run existing Bash scripts and incorporate Ruby code directly into shell scripts.

Rubish is an open-source project that implements a Unix shell entirely in Ruby, parsing and compiling shell syntax into Ruby code which is then executed by the Ruby virtual machine. It supports all Bash features, making it compatible with existing Bash scripts, which can run without modification. The shell also offers advanced Ruby integration, enabling users to embed Ruby expressions, use Ruby methods, and chain commands with Ruby syntax.

The shell can be installed via Homebrew on macOS or built from source, and can be used interactively, for executing single commands, or as a login shell. Key features include Ruby conditionals, method call syntax for commands, command chaining, inline Ruby evaluation, Ruby array and regexp literals, lambda expressions, Ruby-style function definitions, customizable prompts, and lazy loading of environment initializations. It also supports Zsh-style features and can operate in restricted mode for safer execution of untrusted scripts.

Why It Matters

This development is significant because it bridges the gap between shell scripting and Ruby programming, enabling developers to leverage Ruby’s powerful features directly within shell scripts. It simplifies complex scripting tasks, enhances automation, and offers a unified environment for system management and scripting. The compatibility with Bash ensures minimal disruption for existing workflows, while the deep Ruby integration opens new possibilities for scripting and automation in Ruby-centric environments.

Amazon

Unix shell with Ruby support

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Background

Prior to Rubish, Unix shells like Bash and Zsh were dominant for scripting and command-line operations, but lacked deep integration with high-level programming languages. Ruby, known for its expressiveness and extensive libraries, has been popular for scripting but was not traditionally used as a shell language. If you’re interested in alternative Unix shells, check out Rubish, which aims to combine these worlds by creating a Ruby-based shell that preserves Bash syntax and features.

“Rubish is designed to be fully Bash-compatible while allowing deep Ruby integration, making it a powerful tool for developers who want the flexibility of Ruby in shell scripting.”

— Amatsuda (creator of Rubish)

“Running existing Bash scripts without modification can significantly streamline workflows, especially for Ruby developers looking to automate system tasks.”

— Open-source community member

Amazon

Bash compatible shell scripting tools

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

What Remains Unclear

It is not yet clear how widely adopted Rubish will become or how it performs in large-scale or complex scripting environments. Compatibility with all Bash scripts has been claimed, but real-world testing may reveal edge cases or limitations. Additionally, the long-term stability and support for this project are still uncertain, as it is relatively new.

Amazon

Ruby scripting automation tools

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

What’s Next

Next steps include community testing and feedback, development of additional features, and integration into more system environments. Developers may begin porting existing Bash scripts or creating new scripts that leverage Ruby’s capabilities. For more information on shell scripting and automation, visit the Rubish project page.

Amazon

command line shell with Ruby integration

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Key Questions

Can I run my existing Bash scripts in Rubish without modification?

Yes, Rubish claims full Bash compatibility, so existing Bash scripts should run without changes. However, any scripts with unsupported or edge-case features may require adjustments.

How does Rubish compare to traditional shells like Bash or Zsh?

Rubish supports Bash syntax and features but adds deep Ruby integration, allowing Ruby code within scripts and command chaining with Ruby methods. Unlike Bash or Zsh, it is implemented entirely in Ruby.

Is Rubish suitable for production system scripting?

While promising, Rubish is relatively new. Users should evaluate its stability and compatibility in their specific environments before deploying it for critical tasks.

How can I install Rubish?

On macOS, use Homebrew: ‘brew tap amatsuda/rubish’ followed by ‘brew install –HEAD rubish’. From source, clone the repository and follow the build instructions. It can also be used as a login shell or in scripts.

Source: Hacker News

FALL

Fall Picks

As an affiliate, we earn on qualifying purchases.

You May Also Like

“Code Was Never The Hard Part” Is An Insult To All Programmers

Programmers and industry experts debate whether dismissing coding challenges as trivial is insulting to developers’ skills and efforts.

Mounting git commits as folders with NFS (2023)

A new project enables mounting git commits as folders via NFS on Mac, offering an alternative to FUSE and exploring how git’s structure can be visualized as a filesystem.

Learning Software Architecture

An analysis of how software architecture is learned, its social influences, and practical advice for developers based on recent expert reflections.

Gooey: A GPU-accelerated UI framework for Zig

Gooey introduces a GPU-accelerated, cross-platform UI framework for Zig, supporting macOS, Linux, and WebAssembly. Early development underway.