mirror of https://github.com/mirror/busybox.git
hush: add support for special vars in braces
Some people like to use ${?} rather than $?, so make sure we support all the special single char vars that use this form. Signed-off-by: Mike Frysinger <vapier@gentoo.org>1_15_stable
parent
ff64fb9e31
commit
dc3bc40578
|
@ -5303,6 +5303,9 @@ static int handle_dollar(o_string *as_string,
|
||||||
all_digits = true;
|
all_digits = true;
|
||||||
goto char_ok;
|
goto char_ok;
|
||||||
}
|
}
|
||||||
|
/* They're being verbose and doing ${?} */
|
||||||
|
if (i_peek(input) == '}' && strchr("$!?#*@_", ch))
|
||||||
|
goto char_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expansion < 2
|
if (expansion < 2
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
hush: syntax error: unterminated ${name}
|
hush: syntax error: unterminated ${name}
|
||||||
hush: syntax error: unterminated ${name}
|
|
||||||
0
|
0
|
||||||
0
|
0
|
||||||
_
|
_
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# do all of these in subshells since it's supposed to error out
|
# do all of these in subshells since it's supposed to error out
|
||||||
|
|
||||||
# first try some invalid patterns
|
# first try some invalid patterns
|
||||||
"$THIS_SH" -c 'echo ${?}'
|
#"$THIS_SH" -c 'echo ${?}' -- this is valid as it's the same as $?
|
||||||
"$THIS_SH" -c 'echo ${:?}'
|
"$THIS_SH" -c 'echo ${:?}'
|
||||||
|
|
||||||
# then some funky ones
|
# then some funky ones
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
http://busybox.net
|
http://busybox.net
|
||||||
http://busybox.net_abc
|
http://busybox.net_abc
|
||||||
1
|
1 1
|
||||||
1
|
1 1
|
||||||
|
|
|
@ -4,6 +4,6 @@ echo $URL
|
||||||
echo ${URL}_abc
|
echo ${URL}_abc
|
||||||
|
|
||||||
true
|
true
|
||||||
false; echo $?
|
false; echo $? ${?}
|
||||||
true
|
true
|
||||||
{ false; echo $?; }
|
{ false; echo $? ${?}; }
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
hush: syntax error: unterminated ${name}
|
hush: syntax error: unterminated ${name}
|
||||||
hush: syntax error: unterminated ${name}
|
hush: syntax error: unterminated ${name}
|
||||||
hush: syntax error: unterminated ${name}
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# reject invalid vars
|
# reject invalid vars
|
||||||
"$THIS_SH" -c 'echo ${1q}'
|
"$THIS_SH" -c 'echo ${1q}'
|
||||||
"$THIS_SH" -c 'echo ${&}'
|
"$THIS_SH" -c 'echo ${&}'
|
||||||
"$THIS_SH" -c 'echo ${$}'
|
#"$THIS_SH" -c 'echo ${$}' -- this is valid as it's the same as $$
|
||||||
|
|
Loading…
Reference in New Issue