Live data from Hacker News

Ruby: A great language for shell scripts

lucasoshiro.github.io

1–10 of 368 posts

Re: Ruby: A great language for shell scripts

#2
These are great points, if you already have Ruby in your stack.

For me, when Bash ain't enough I upgrade to the Project language (PHP, Python, JS, etc). For compiled project I reach for LSB language (Perl, Python) before introducing a new dependency.

Re: Ruby: A great language for shell scripts

#3
post #2

These are great points, if you already have Ruby in your stack. For me, when Bash ain't enough I upgrade to the Project language (PHP, Python, JS, etc). For compiled project I reach for LSB language (Perl, Python) before introducing a new dependency.

What does LSB stand for?

Re: Ruby: A great language for shell scripts

#4
post #3
post #2

These are great points, if you already have Ruby in your stack. For me, when Bash ain't enough I upgrade to the Project language (PHP, Python, JS, etc). For compiled project I reach for LSB language (Perl, Python) before introducing a new dependency.

What does LSB stand for?

Linux Standard Base. Already on the system.

Re: Ruby: A great language for shell scripts

#5
post #2

These are great points, if you already have Ruby in your stack. For me, when Bash ain't enough I upgrade to the Project language (PHP, Python, JS, etc). For compiled project I reach for LSB language (Perl, Python) before introducing a new dependency.

Ruby is fantastic for the main project language, too! And is also standard on many Linux distros.

Re: Ruby: A great language for shell scripts

#6
Ruby is an amazing language. I've seen some systems it's not already installed on and hop over to something like perl/python in those cases, but Ruby is by far my preferred hammer for small scripts. The code is beautiful.

Small nit: your note in Feature 4 is actually supposed to be in Feature 5, I assume.

Re: Ruby: A great language for shell scripts

#7
post #3
post #2

These are great points, if you already have Ruby in your stack. For me, when Bash ain't enough I upgrade to the Project language (PHP, Python, JS, etc). For compiled project I reach for LSB language (Perl, Python) before introducing a new dependency.

What does LSB stand for?

I assume it means Linux Standard Base:

https://refspecs.linuxbase.org/LSB_3.2.0/LSB-Languages/LSB-L...

Re: Ruby: A great language for shell scripts

#9
I sometimes wonder why we don't see ruby used for shell stuff more often. It inherited most of the good stuff for shell scripting from Perl, and Perl took a lot of it's syntax from sh and sed and awk, so almost anything you can do in shell script you can do in ruby, but with an option of making it gradually less terse and more readable, while having sane variables and data handling from the start.

Also ruby is great in allowing complexity to grow smoothly, no sudden hiccups. You start with just one line (everything goes into module main implicitly), extend it to a single-file script, require some built-in libraries, then add a module or helper class in the same file, and only then maybe extract those files to required files, add gems, whatever. No boilerplate whatsoever, no jumps, no big rewrites.

meanwhile, a lot of tooling nowadays is written in Go, and I have no idea why, it's not friendly for os manipulation at all, and number crunching power is not needed in many, many tasks of that sort.

Post reply on HN