1 2e= q='?' a='*' t=texttext s='ast*que?non' p='/et[c]/' w='a b c' b='{{(#)}}' 3h='##' 4failures='' 5ok='' 6 7testcase() { 8 code="$1" 9 expected="$2" 10 oIFS="$IFS" 11 eval "$code" 12 IFS='|' 13 result="$#|$*" 14 IFS="$oIFS" 15 if [ "x$result" = "x$expected" ]; then 16 ok=x$ok 17 else 18 failures=x$failures 19 echo "For $code, expected $expected actual $result" 20 fi 21} 22 23testcase 'set -- "${b%'\'}\''}"' '1|{{(#)}' 24testcase 'set -- ${b%"}"}' '1|{{(#)}' 25testcase 'set -- "${b%"}"}"' '1|{{(#)}' 26 27test "x$failures" = x 28