This can be fixed by changing the lines in io500_fixed.sh:
[ -z "${!V}" -o "${!V}" = "xxx" ] &&
echo "Need to set '$V' in io500.sh" && exit 1
to
if [ -z "$(eval echo \$$V)" ] || [ "${!V}" = "xxx" ];
then
echo "Need to set '$V' in io500.sh"
exit 1
fi
so that it will produce a useful error message from the shell. Unfortunately, I'm
having trouble pushing a patch to Github right now.
Cheers, Andreas
On Oct 20, 2018, at 15:25, Osamu Tatebe
<tatebe(a)cs.tsukuba.ac.jp> wrote:
Hi Andres,
Thanks for the information. The reason why I cannot
execute is one of variables is not set.
In this case, io500_fixed.sh stops with !V: unbound
variable, instead of echo "Need to set '$V' in io500.sh"
&& exit 1 due to set -u
Thanks,
Osamu
On Sat, 20 Oct 2018 00:33:57 -0600
Andreas Dilger <adilger(a)dilger.ca> wrote:
>> On Oct 19, 2018, at 10:12 AM, Osamu Tatebe via IO-500 <io-500(a)vi4io.org>
wrote:
>>
>> Hi,
>>
>> io500_fixed.sh seems to have a bug.
>>
>> ./bin/io500_fixed.sh: line 48: !V: unbound variable
>>
>> Here are lines in io500_fixed.sh
>>
>> 47: for V in $important_vars; do
>> 48: [ -z "${!V}" -o "${!V}" = "xxx" ]
&&
>> 49: echo "Need to set '$V' in io500.sh" && exit 1
>> 50: done
>>
>> Why ${!V} instead of ${V}?
>
> The "${!V}" syntax means "print the variable whose name
> is stored in "$V". In this case, $important_vars holds
> a list of variable names that need to be set for io500
> to run properly, and this code is an efficient way to
> check that all of them are set.
>
> Are you running on a system that does not use bash, or
> a very old version of bash that doesn't handle ${!VAR}?
>
> Cheers, Andreas
--
Osamu Tatebe <tatebe(a)cs.tsukuba.ac.jp>