common: Allow undefined $gsu_errors.
authorAndre Noll <maan@tuebingen.mpg.de>
Tue, 3 Mar 2015 17:28:19 +0000 (18:28 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Tue, 3 Mar 2015 17:28:19 +0000 (18:28 +0100)
If this variable is undefined, and the nounset option is turned on
(set -u), gsu aborts early when setting up the gsu_error_txt array.

Fix this by using ${gsu_errors:-} instead of plain $gsu_errors to
allow for scripts without error codes.

Reported by Congmao Wang.

common

diff --git a/common b/common
index e326890..d418095 100644 (file)
--- a/common
+++ b/common
@@ -19,7 +19,7 @@ E_GSU_GETOPTS                 getopts error
 E_GSU_DIALOG                   dialog error
 E_GSU_MKTEMP                   mktemp error
 E_GSU_MENU_TREE                        invalid menu tree
-$gsu_errors
+${gsu_errors:-}
 "
        local a b i=0
        while read a b; do