Scripting (2 blogmarks)

← Blogmarks

Ruby for "shell scripting"

https://ratfactor.com/cards/ruby-shell-scripts

Ruby is a really good Unix citizen and I think it’s woefully underused as a general-purpose "scripting" language.

This article is a nice background and introduction to using Ruby for scripting. I've always felt that small, expressive scripts are one of Ruby's strong suits. When I need a personal one-off script to automate a set of steps, I almost always reach for Ruby.

Here is a fun tidbit:

I think this ancestral timeline may be interesting:

  • 1977 AWK by Aho, Weinberger, and Kernighan

  • 1987 Perl by Larry Wall

  • 1995 Ruby by Yukihiro Matsumoto

I had no idea that awk was so named because it is the initials of the creators.

List of all ShellCheck Rules

https://www.shellcheck.net/wiki/

This is the root wiki page for ShellCheck which lists all of the rules that it enforces when checking your scripts.

Each rule links to a page that describes the issue, shows you an example of the problematic code, and a corrected version.

E.g. SC1003 Want to escape a single quote? echo 'This is how it'\''s done.' shows:

Problematic code:

echo 'this is not how it\'s done'

Corrected code:

echo 'this is how it'\''s done'