|
|
|
|
|
by jacob2161
293 days ago
|
|
Stylistically, I much prefer #!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
It reminds me when I wrote a lot of Perl: #!/usr/bin/perl
use strict;
use warnings;
I also prefer --long --args everywhere possible and a comment on any short flag unless it's incredibly common.I've been writing all my Bash scripts like this for ~15 years and it's definitely the way to go. |
|
The short args are great for when you’re typing into a terminal. But when you’re writing and saving a script, be descriptive! One of the most irritating things about bash (and Linux, I guess?) is how magical all the -FEU -lh 3 -B 1 incantations are. They give off a vibe I call “nerd snobbish” where it’s a sort of “oh you don’t know what that all means? How fretful!”