On Sun, 16 Aug 2015, D. Hugh Redelmeier wrote:

| From: Bob Jonkman <[email protected]>

Thanks.

Here's a slightly shorter version.  Picky, picky, picky.  Looking gift
horse in the mouth.

I try to start all my scripts with "set -eu" so that more bugs will be
detected.

"set -e" causes the shell to exit if a command unexpectedly fails.
That is, a command returns non-zero and was invoked in a non-test
context.  Just what you want.

    It only causes the shell to exit if a simple command fails.

    Best practice is not to use it at all.

   <http://mywiki.wooledge.org/BashFAQ/105>

"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.

--
Chris F.A. Johnson, <http://cfajohnson.com>
---
Talk Mailing List
[email protected]
http://gtalug.org/mailman/listinfo/talk

Reply via email to