t/shelltest.od: another test for ${x#y} behaviour.

If y contains a * character, it's a case-esac style wildcard unless it's in
"" or '', which tells it to match a literal *.  But in dash/busybox, the ''
quoting doesn't actually work, only "" does.

Since there's a workaround - just always use "" quoting - it's not that
fatal.  If the "" quoting doesn't work, then we'll make it fail.
This commit is contained in:
Avery Pennarun 2011-04-02 16:30:14 -07:00
commit e9e24bb450

View file

@ -196,17 +196,25 @@ i=2 ls >/dev/null
var='a a b b'
var2='*a'
t1=${#var}
t2=${var#a* }
t3=${var##a* }
t4=${var%b*}
t5=${var%%b*}
t6="${var2#'*'}"
t7="${var2#"*"}"
[ "$t1" = "7" ] || fail 51
[ "$t2" = "a b b" ] || fail 52
[ "$t3" = "b" ] || fail 53
[ "$t4" = "a a b " ] || fail 54
[ "$t5" = "a a " ] || fail 55
# shells I tested work with #"*" but dash doesn't work with #'*' . The
# workaround is to simply use double quotes, so I'll make that one a warning.
[ "$t6" = "a" ] || warn 56
[ "$t7" = "a" ] || fail 56
in="a
b