On 17 August 2015 at 01:42, D. Hugh Redelmeier <[email protected]> wrote:
> | From: Chris F.A. Johnson <[email protected]> > > | Best practice is not to use it at all. > | > | <http://mywiki.wooledge.org/BashFAQ/105> > Sorry, late to this thread, but that page doesn't refer to -u > Thanks. Useful. I respectfully disagree with the conclusion. > > | > "set -u" tells the shell to treat a reference to an undefined > | > parameter as an error. It will make no difference in this script. > | > Until the script evolves more complexity. > | > | There's no point to using set -u after a script has been debugged. > > The sad fact is that I don't know when I've gotten rid of the last bug > in a script. > I don't know when I've gotten the last bug in *any* language (of course I've only been programming for 44 years, so maybe I'll get to that point sometime :-). The only reason I can even *imagine* turning it off after "debugging" would be a claim for "efficiency". And to suggest that "the overhead of having the bash interpreter check this" is material is misguided (see Hugh's quotes from Tony Hoare). There are *very*, *very* few programs that need that kind of micro-efficiency, which is why I virtually never program in C or C++ anymore -- safety is so much more important. ../Dave
--- Talk Mailing List [email protected] http://gtalug.org/mailman/listinfo/talk
