<!DOCTYPE html><html><head><title></title></head><body><div>On Thu, Aug 14, 2025, at 14:31, Ron wrote:</div><blockquote type="cite" id="qt" style=""><div><br></div><div>Quick question:</div><div><br></div><div>* how regularly do you put `set` in your bash scripts?</div></blockquote><div><br></div><div><div>Usually just `set -x` temporarily for debugging.</div><div><br></div><div>set -e has never been of any benefit in my experience. I tend to do explicit checks (of $?, of expected output from commands, etc), as my scripts very probably have cleanup or logging that needs to be performed in case of failure (and some failures are not fatal, and sometimes expected).</div><div><br></div><div>Having scripts terminate unexpectedly because a command failed would cause more problems that are easily resolved by an extra 'if' statement.</div><div><br></div><div>Pipefail is potentially more useful, but I've never actually taken care to implement it. I'm not sure I've ever really been in a position where it would help, and there's quite a few scenarios where I don't care about exit statuses for most commands in a pipe.</div><div><br></div></div><blockquote type="cite" id="qt" style=""><div>* how often do you trap signals in your bash scripts?</div></blockquote><div><br></div><div><div>Last time I trapped signals was when we had a monster bash script to manage application startup/life/shutdown (including forking multiple sub-processes, failure reporting, etc). About 95% of that script (including signal handling) was removed when we migrated to systemd units.</div><div><br></div><div id="sig91988184"><div class="signature">--</div><div class="signature"><b>Chris Irwin</b></div><div class="signature"><br></div><div class="signature"><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;">email: <a href="mailto:chris@chrisirwin.ca">chris@chrisirwin.ca</a></span></div><div class="signature"><span class="font" style="font-family:menlo, consolas, monospace, sans-serif;"> web: <a href="https://chrisirwin.ca">https://chrisirwin.ca</a></span></div></div><div><br></div></div><div><br></div><div><br></div></body></html>