TL;DR

Rubish is a Unix shell implemented in pure Ruby, offering full Bash compatibility and seamless Ruby integration. It allows running existing scripts and mixing Ruby code directly in shell scripts. The project is available via Homebrew and source, aiming to enhance scripting flexibility.

Rubish, a Unix shell fully implemented in Ruby, has been released, enabling users to run Bash scripts without modification and integrate Ruby code directly into shell scripts. This development matters because it combines the scripting power of Bash with the versatility of Ruby, potentially transforming shell scripting workflows.

Rubish is a shell that parses and compiles Bash syntax into Ruby code, which is then executed by the Ruby VM. It supports all Bash features, making existing Bash scripts compatible without changes, and considers any unsupported script as a bug to be reported. The shell deeply integrates Ruby, allowing users to invoke Ruby expressions, methods, blocks, and classes directly from the shell prompt. It also offers advanced features like method chaining, inline Ruby evaluation, custom prompts, and lazy loading of environment initializations.

The project can be installed via Homebrew on macOS with the command ‘brew tap amatsuda/rubish’ followed by ‘brew install –HEAD rubish’, or built from source by cloning the GitHub repository and following the setup instructions. Rubish can be used interactively, for executing single commands, or as a login shell, with support for both Bash and Zsh features. It also provides a public API for embedding in Ruby programs, making it versatile for various scripting needs.

Why It Matters

This development is significant because it offers a new way to leverage Ruby’s capabilities within shell scripting, potentially simplifying complex automation tasks, enabling more powerful scripting, and reducing the need to switch between different languages or environments. For developers and sysadmins, it could streamline workflows and improve script portability across systems that support Ruby and Bash.

Amazon

Unix shell scripting book

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Background

The release of Rubish builds on the trend of integrating scripting languages into system shells to enhance flexibility. Previous efforts focused on Bash or Zsh extensions; Rubish distinguishes itself by rewriting the entire shell in Ruby, ensuring full compatibility with Bash syntax and semantics. The project is part of ongoing efforts to modernize shell scripting and incorporate more powerful programming constructs into everyday command-line workflows. Its development aligns with the increasing popularity of Ruby for automation and scripting tasks, offering a unified environment for system commands and Ruby code.

“Rubish allows seamless mixing of Bash commands and Ruby code, making shell scripting more expressive and powerful.”

— Amatsuda, project creator

“It’s exciting to see a shell written entirely in Ruby that supports all Bash features and adds Ruby’s capabilities natively.”

— Hacker News user

Amazon

Ruby programming automation 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. For a related project, see Zerostack – A Unix-inspired coding agent written in pure Rust. Compatibility with all Bash scripts is claimed but not exhaustively tested; some edge cases may still be unconfirmed or pending user feedback.

Amazon

Bash compatible shell for Mac

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

What’s Next

Next steps include broader testing by the community, reporting of bugs or incompatibilities, and potential integration into more systems. Developers may also explore embedding Zerostack in their workflows. Developers may explore embedding Rubish in Ruby applications or extending its features. Future updates could enhance performance, add more features, or improve compatibility with other shells.

Amazon

Advanced shell scripting tools

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, allowing existing Bash scripts to run without changes. If any script does not work, it should be reported as a bug.

How does Rubish integrate Ruby code into shell scripts?

Rubish allows inline Ruby expressions, method calls, blocks, and class usage directly within shell scripts, enabling more complex and flexible scripting.

Is Rubish suitable for production environments?

While promising, Rubish is a new project. Users should evaluate its stability and compatibility for production use, and keep an eye on updates and community feedback.

How can I install Rubish?

On macOS, install via Homebrew with ‘brew tap amatsuda/rubish’ and ‘brew install –HEAD rubish’. Alternatively, clone the GitHub repository and follow the build instructions for other systems.

Source: Hacker News

You May Also Like

Why College Students Are Booing AI

Students have booed speakers mentioning AI at multiple universities, reflecting mixed feelings about the technology’s impact on their future.

Show HN: ShadowCat – file transfer through QR Codes in a Browser

ShadowCat is a new browser-based tool enabling offline file transfer through QR codes, designed for old phones with limited radios but working cameras.

NASA is opening up bids for who will run the Jet Propulsion Laboratory

NASA has announced it will solicit bids from interested parties to manage the Jet Propulsion Laboratory after Caltech’s contract ends in 2028, opening a competitive process.

Apple cofounder Steve Wozniak got cheers, not boos, after telling students they ‘all have AI — actual intelligence’

Apple cofounder Steve Wozniak was cheered at Grand Valley State University after telling students they ‘have AI — actual intelligence.’