better compatibility with set -u
authorIan Kelling <iank@fsf.org>
Mon, 16 Jul 2018 15:58:43 +0000 (11:58 -0400)
committerIan Kelling <iank@fsf.org>
Mon, 16 Jul 2018 15:58:43 +0000 (11:58 -0400)
err

diff --git a/err b/err
index f4aca22ceaf8d1bf74008b06f1a3a5edae110f19..f573fbbb894b0abbddeca577bbd3cc13b332e0ae 100644 (file)
--- a/err
+++ b/err
@@ -69,7 +69,7 @@ err-catch() {
     echo "${BASH_SOURCE[1]}:${BASH_LINENO[0]}:in \`$BASH_COMMAND' returned $err"
     # err trap does not work within an error trap, the following line:
     err-bash-trace 2; set -e
     echo "${BASH_SOURCE[1]}:${BASH_LINENO[0]}:in \`$BASH_COMMAND' returned $err"
     # err trap does not work within an error trap, the following line:
     err-bash-trace 2; set -e
-    "${_errcatch_cleanup[@]}"
+    "${_errcatch_cleanup[@]:-}" # note :- is to be compatible with set -u
     echo "$0: exiting with code $err"
     exit $err
   }
     echo "$0: exiting with code $err"
     exit $err
   }