examples: beware of shell portability issues

This completes 2d7e743802.

Some shells don't grok "local var=`cmd`" very well: they need the rhs
to be quoted.

    ./examples/test: 72: local: you.,: bad variable name
    FAIL examples/variant.test (exit status: 2)

Reported by Étienne Renault.

* examples/test (run): Quote the values in 'local' assignments.
This commit is contained in:
Akim Demaille
2018-09-02 09:20:06 +02:00
parent d023679818
commit d908fb3f18

View File

@@ -69,7 +69,7 @@ run ()
local sta_eff=0
$prog "$@" - <input >out_eff || sta_eff=$?
# Effective output.
local out_eff=`cat out_eff`
local out_eff="`cat out_eff`"
if test $sta_eff -eq $sta_exp; then
if test "$out_eff" = "$out_exp"; then
echo "$me: PASS: $number"