Upstream commit:
Date: Thu, 4 Oct 2007 22:15:10 +0800
[PARSER] Fix parsing of ${##1}
Previously dash treated ${##1} as a length operation. This patch fixes that.
Test case:
set -- a
echo ${##1}OK
Old result:
1OK
New result:
OK
This was a real bug in ash (but not in hush).
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
25 lines
449 B
Plaintext
Executable File
25 lines
449 B
Plaintext
Executable File
"$THIS_SH" -c 'echo $#'
|
|
"$THIS_SH" -c 'echo $#' arg0
|
|
"$THIS_SH" -c 'echo $#' arg0 arg1
|
|
|
|
echo Make sure len parsing doesnt break arg count
|
|
set --
|
|
echo $# ${#}
|
|
set -- aaaa bbb cc d
|
|
echo $# ${#}
|
|
|
|
echo Testing len op
|
|
echo ${#1} ${#2} ${#3} ${#4} ${#5} ${#6}
|
|
|
|
unset e
|
|
f=abc
|
|
g=
|
|
echo ${#e} ${#f} ${#g}
|
|
|
|
set -- a
|
|
# This must be interpreted as: $# ("1"), then remove trailing "1".
|
|
# IOW: empty result.
|
|
echo Nothing:${##1}
|
|
echo Nothing:${#%1}
|
|
echo One:${##x}
|