2026-01-13 19:36 UTC
@awb things i make sure people are familiar with when they're doing shell scripting:
Showing how shellcheck can highlight errors as well as common/subtle mistakes and can encourage defensive coding would be a good addition - shellcheck can find potential problems before you run your script
Starting (bash?) scripts with set -euo pipefail can help catch unexpected problems at runtime before they cascade into weird/unexpected behaviors
Clarifying what return codes are (whether for functions or running commands), and the meaning of the value: 0 being "success" and nonzero indicating errors.
and using set -x when all else fails and you really need to see exactly what your script is doing
Edit:
oh and also, a slightly more "advanced" thing (but fine for an engineering focused talk) would be using something like bats as a simple way to implement tests for your scripts if/where appropriate. (This also encourages breaking the script into functions etc that can be individually tested which can only be a good thing...)
Replies (0)
No replies.