On 2026-02-21 17:34:19+0000, Crystal Kolipe <[email protected]> wrote: > On Sat, Feb 21, 2026 at 10:25:04AM -0700, Luke Call wrote: > > On 2026-02-21 11:47:40+0000, Crystal Kolipe <[email protected]> > > wrote: > > > On Fri, Feb 20, 2026 at 07:28:46PM -0800, Samuel wrote: > > > > > > > #!/bin/ksh > > > > > > > > set -e > > > > > > Do not use 'set -e' here. Or anywhere. Not in this script nor in any > > > other > > > new script that you write. > > > > I'm surprised. Why is that? > Because: > * It's more correct to do explicit error checking for each possible failure > * A lot of people get usage of set -e wrong
On 2026-02-22 20:35:47+1100, jslee <[email protected]> wrote: > Besides the fine details of set -e: why would you skip an opportunity to give > the user direct, explicit, relevant feedback? > > Requiring the user to read and understand the script (vs reading > documentation eg. manpages) to debug failures is unnecessarily user-hostile > ----- Forwarded message from riley <[email protected]> ----- > Date: Sun, 22 Feb 2026 00:54:05 +0000 > From: riley <[email protected]> > To: [email protected] > > the wooledge wiki has a really great writeup on that topic: > https://mywiki.wooledge.org/BashFAQ/105 > i think it might be just the explanation you're looking for :) > tldr is basically that set -e is inconsistent and shouldn't be relied on. I appreciate the informative responses, and that wiki link. Most of the scripts I write are just for my own benefit and I use "set -x". so "set -e" seems a suitable cost/benefit tradeoff. I don't generally use most of the constructs in the above-linked wiki page examples, and even that had contrasting opinions. I do see value in being thorough with anything that is to be used by others, and to be more aware of gotchas, so, thank you for the info and perspectives. I am a fan of good error handling. Used to use mainly Perl/Java/Scala/C++, now switching to Rust; weak in C/C++. (I once wrote a C program for my employer where I had to check explicitly for errors after every line, either based on a return code, an environment variable, or calling an error-checking function. Very verbose. Like this email I guess.) Thanks much. Luke Call lukecall.net

