From e9e24bb450f063709661e220399f6983e3c9b777 Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Sat, 2 Apr 2011 16:30:14 -0700 Subject: [PATCH] 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. --- t/shelltest.od | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/t/shelltest.od b/t/shelltest.od index b0382a1..767a4ea 100644 --- a/t/shelltest.od +++ b/t/shelltest.od @@ -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