Ruby: A great language for shell scripts
Role of Ruby in Shell Scripting
- Many commenters like Ruby as a “next step” when Bash becomes unwieldy: better data structures, cleaner syntax, easier to grow from one-liners into structured scripts.
- Ruby’s backticks and stdlib (e.g.,
Open3,Pathname, threads) are seen as strong primitives for system scripting. - Some prefer mixing shell with embedded Ruby for the “hard bits,” though this can reduce readability.
Availability & Deployment Concerns
- A major objection: Ruby usually isn’t installed by default on common Linux distros, BSDs, Docker base images, or locked-down corporate environments.
- For many, “already on the system” is decisive; this favors sh/Bash, Python, or Perl.
- Others argue that installing Ruby via the package manager is trivial and shouldn’t block its use, but several note bureaucratic or air‑gapped environments where adding interpreters is non‑trivial.
Comparisons with Other Languages
- Perl is frequently cited as Ruby’s spiritual predecessor and still excellent for scripting, with the advantage of near‑universal availability and CPAN.
- Python “won the war” for non‑Bash scripting on Linux; even people who prefer Ruby often default to Python because it’s standard.
- Go and Rust are praised for single static binaries and predictable deployment; many modern CLI tools use Go for this reason despite less “scripty” ergonomics.
- Some mention D, Julia, Scala (Ammonite), Elixir, Nushell, and Java as alternative “scripting” environments.
Performance & Startup Time
- Older Ruby versions were widely perceived as slow; newer Ruby with YARV/YJIT is said to be much faster, comparable to or better than CPython in some benchmarks.
- There is disagreement about Ruby’s startup time: some see ~100ms as a serious drawback for small scripts; others report much faster startup or consider it irrelevant when shelling out to other programs.
Large Projects, Typing, and Tooling
- Several criticize Ruby (especially with Rails) for dynamic typing, heavy metaprogramming, global namespace issues, and implicit loading, which they say make large codebases hard to reason about.
- Others counter with successful long‑lived Ruby systems and argue that discipline, not language, is the main factor.
- Editor/tooling: Python is seen as having stronger LSP and IDE support (especially in VS Code); Ruby tooling is improving but is reported as less smooth and sometimes fragile.
Dependencies & Inline Deps
- Inline dependency mechanisms in Ruby (Bundler inline) are praised as powerful for single‑file scripts, but some worry about version pinning and reproducibility.
- Parallel discussion highlights similar emerging features in Python (PEP 723), Rust, and other ecosystems.