Top all-time · #1343
Aaron Maxwell
Personal blog · redsymbol.net/articles · on HN as redsymbolprogramming
Aaron Maxwell's personal blog at redsymbol.net covers programming. Since 2009, 51 different Hacker News readers have linked it 62 times, most often “Use the Unofficial Bash Strict Mode (Unless You Love Debugging)”. No feed was found, so read it on the site itself.
Too few sampled comments (29) to say how often HN recommends it.?
Why HN links it
Aaron Maxwell's bash articles, chiefly the 'Unofficial Bash Strict Mode' guide. HN readers cite it as a standard reference for safer shell scripts using set -euo pipefail and IFS settings.
Summarised by Claude from a sample of 29 HN comments that link here. Each comment is marked recommending, critical or neutral (citing without judging); how this works.
Most-linked posts?
- Use the Unofficial Bash Strict Mode (Unless You Love Debugging)41 people · 46 mentions · first linked 2014-07-18
- How “Exit Traps” Can Make Bash Scripts More Robust and Reliable5 people · 5 mentions · first linked 2012-12-28
- Why I'm Coding in Python 3 (Hint: It's About Gratitude.)2 people · 2 mentions · first linked 2013-04-05
What Hacker News says?
I've always had good results following "Unofficial Bash Strict Mode": http://redsymbol.net/articles/unofficial-bash-strict-mode/
Comment linking /articles/unofficial-bash-strict-mode/
on “Shell script best practices, from a decade of scripting things”Submitted Use the Unofficial Bash Strict Mode (Unless You Love Debugging) as a story · 180 points
HN discussionObligatory: http://redsymbol.net/articles/unofficial-bash-strict-mode/
Comment linking /articles/unofficial-bash-strict-mode/
on “Safe ways to do things in bash”Submitted How “Exit Traps” Can Make Bash Scripts More Robust and Reliable as a story · 158 points
HN discussionThe thing I wished I had learned earlier is "quick and dirty assertions". If you write lots of functions in Bash, you quickly end up getting tripped up by cases where an argument is omitted and the function does something totally batshit given the missing (empty string) argument. Now, the canonical way to handle this is to put validators on your input, (and make sure those validators don't crash with cryptic errors…
Comment linking /articles/unofficial-bash-strict-mode/
on “Things I Wish I'd Known About Bash”Submitted Use the unofficial Bash strict mode as a story · 96 points
HN discussionMy take on the same topic: - use the unofficial strict mode: http://redsymbol.net/articles/unofficial-bash-strict-mode/ - use parameter substitutions like ${foo#prefix}, ${foo%suffix} instead of invoking sed/awk - process substitution instead of named pipes: <(), >() - know the difference between an inline group {} and a subshell () - use printf "%q" when passing variables to another shell (e.g. assembling a command…
Comment linking /articles/unofficial-bash-strict-mode/
on “Things I Wish I'd Known About Bash”Submitted Crash course in applied functional programming as a story · 55 points
HN discussionThis is generally terrible advice. A better option is to 'set -e' and ensure that the bash script exits when there's a failure. Bash scripts can't be idempotent because they operate in an external environment that can't ever be. The better option is to just be extra safe. See: > http://redsymbol.net/articles/unofficial-bash-strict-mode/
Comment linking /articles/unofficial-bash-strict-mode/
on “How to write idempotent Bash scripts”Submitted Bash Strict Mode (2014) as a story · 48 points
HN discussionhttp://redsymbol.net/articles/unofficial-bash-strict-mode/
Comment linking /articles/unofficial-bash-strict-mode/
on “Moved ~/.local/share/steam. Ran steam. It deleted everything owned by user”Submitted Bash Strict Mode as a story · 13 points
HN discussionrelated: http://redsymbol.net/articles/unofficial-bash-strict-mode
Comment linking /articles/unofficial-bash-strict-mode
on “Writing Safe Shell Scripts (2019)”Submitted Use Bash Strict Mode (Unless You Love Debugging) as a story · 10 points
HN discussioni'm surprised it doesn't recommend using set -e /other flags. [ http://redsymbol.net/articles/unofficial-bash-strict-mode/ ] maybe it is not covered because it is not considered 'style' but i think those flags are some of the most important things you can set when writing a bash script. i guess if you are writing scripts that start other things, and then check their error codes it can be annoying because you have tu…
Comment linking /articles/unofficial-bash-strict-mode/
on “Shell Style Guide”Submitted Use Bash Strict Mode (Unless You Love Debugging) as a story · 10 points
HN discussionNot an expert on Nix, but it's not so much that Nix has problems (though I'm sure it does, my initial research suggested it's not quite there yet for Python packages) but that there other things you need to get right. For example: 1. Signal handling (only one bit of https://hynek.me/articles/docker-signals/ is Dockerfile specific, the rest still applies.) 2. Configuring servers to run correctly in Docker environment…
Comment linking /articles/unofficial-bash-strict-mode/
on “Simple Dockerfile examples are often broken by default”Submitted Using Exit Traps In Bash as a story · 10 points
HN discussionA better approach is to avoid writing bash scripts. They're just too dangerous, even with "strict mode" ( http://redsymbol.net/articles/unofficial-bash-strict-mode/ ). Better to use Python, or Ruby, or a Rust or Go executable.
Comment linking /articles/unofficial-bash-strict-mode/
on “How to write idempotent Bash scripts (2019)”Submitted Use bash strict mode (Unless you love debugging) as a story · 4 points
HN discussion+1 This is where I’ve learned proper bash. People always compliment my bash skills, but the only thing I do is sticking to the wooledge wiki’s rules + using the unofficial bash strict mode ( http://redsymbol.net/articles/unofficial-bash-strict-mode/ ).
Comment linking /articles/unofficial-bash-strict-mode/
on “Bash $* and $@ (2017)”Submitted “Exit Traps” Can Make Your Bash Scripts Way More Robust and Reliable as a story · 4 points
HN discussionAlso known as "bash strict mode". It's a godsend if you're unlucky enough to have to deal with bash scripting. http://redsymbol.net/articles/unofficial-bash-strict-mode/ EDIT: The comic strip would be better in three rows of two panels - a row for each set flag.
Comment linking /articles/unofficial-bash-strict-mode/
on “Bash Error Handling”Submitted Use Bash Strict Mode (Unless You Love Debugging) as a story · 4 points
HN discussionGood idea -- here is an explanation: http://redsymbol.net/articles/unofficial-bash-strict-mode/
Comment linking /articles/unofficial-bash-strict-mode/
on “Compiling my own SPARC CPU inside a cheap FPGA”Submitted Unoffical Bash Strict Mode as a story · 4 points
HN discussionThe bash -e and -u options might have saved him here: http://redsymbol.net/articles/unofficial-bash-strict-mode/
Comment linking /articles/unofficial-bash-strict-mode/
on “Man accidentally 'deletes his entire company' with one line of bad code”Submitted Use Bash Strict Mode (Unless You Love Debugging) as a story · 3 points
HN discussionAlso, "unofficial bash strict mode" is terrific, especially if you intend to distribute a script: http://redsymbol.net/articles/unofficial-bash-strict-mode/ set -euo pipefail IFS=$'\n\t' (You can always turn, for example, error checking back off for an individual portion of the script with `set +e`)
Comment linking /articles/unofficial-bash-strict-mode/
on “Replacing Dropbox in favor of DigitalOcean spaces”Submitted Unofficial Bash Strict Mode as a story · 3 points
HN discussion