[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gettext] gettext.sh and bash "shopt -o -s nounset"

From: Thorsten Kampe
Subject: [bug-gettext] gettext.sh and bash "shopt -o -s nounset"
Date: Thu, 12 May 2011 20:22:02 +0200


In my bash scripts I set "nounset" (and errexit) to prevent unset 
variables from being used. Using variables which might not be set is 
convenient in interactive shell sessions but dangerous in non-
interactive scripts.


    shopt -o -s errexit nounset
    source gettext.sh

...in a script results in:
/usr/bin/gettext.sh: line 43: ZSH_VERSION: unbound variable

...which refers to the following line in gettext.sh: "if test -z 
"$ZSH_VERSION"; then".

if [ x${ZSH_VERSION+set} = xset ]
if [ -n "${ZSH_VERSION+x}" ]

portably test for the existence of a variable (tip from zsh mailing 

While there is a workaround for this (first sourcing, then setting 
"nounset"), I'd still consider this a bug. Is this enough to qualify for 
a bug report?

gettext on Gentoo Linux and on Cygwin

reply via email to

[Prev in Thread] Current Thread [Next in Thread]