mirror of
https://github.com/sheumann/hush.git
synced 2024-09-12 00:55:11 +00:00
function old new delta handle_dollar 574 681 +107 expand_and_evaluate_arith - 77 +77 expand_vars_to_list 2302 2374 +72 add_till_closing_bracket 359 368 +9 builtin_exit 48 47 -1 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 3/1 up/down: 265/-1) Total: 264 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
69 lines
1.9 KiB
Plaintext
Executable File
69 lines
1.9 KiB
Plaintext
Executable File
# first try some invalid patterns
|
|
# do all of these in subshells since it's supposed to error out
|
|
export var=0123456789
|
|
"$THIS_SH" -c 'echo ${:}'
|
|
"$THIS_SH" -c 'echo ${::}'
|
|
"$THIS_SH" -c 'echo ${:1}'
|
|
"$THIS_SH" -c 'echo ${::1}'
|
|
|
|
#this also is not valid in bash, but we accept it:
|
|
"$THIS_SH" -c 'echo ${var:}'
|
|
|
|
# then some funky ones
|
|
# UNFIXED BUG: this should work: "$THIS_SH" -c 'echo ${?:0}'
|
|
|
|
# now some valid ones
|
|
set --; echo "1 =|${1}|"
|
|
set --; echo "1:1 =|${1:1}|"
|
|
set --; echo "1:1:2=|${1:1:2}|"
|
|
set --; echo "1::2 =|${1::2}|"
|
|
set --; echo "1:1: =|${1:1:}|"
|
|
set --; echo "1:: =|${1::}|"
|
|
|
|
set -- 0123; echo "1 =|${1}|"
|
|
set -- 0123; echo "1:1 =|${1:1}|"
|
|
set -- 0123; echo "1:1:2=|${1:1:2}|"
|
|
set -- 0123; echo "1::2 =|${1::2}|"
|
|
set -- 0123; echo "1:1: =|${1:1:}|"
|
|
set -- 0123; echo "1:: =|${1::}|"
|
|
|
|
unset f; echo "f =|$f|"
|
|
unset f; echo "f:1 =|${f:1}|"
|
|
unset f; echo "f:1:2=|${f:1:2}|"
|
|
unset f; echo "f::2 =|${f::2}|"
|
|
unset f; echo "f:1: =|${f:1:}|"
|
|
unset f; echo "f:: =|${f::}|"
|
|
|
|
f=; echo "f =|$f|"
|
|
f=; echo "f:1 =|${f:1}|"
|
|
f=; echo "f:1:2=|${f:1:2}|"
|
|
f=; echo "f::2 =|${f::2}|"
|
|
f=; echo "f:1: =|${f:1:}|"
|
|
f=; echo "f:: =|${f::}|"
|
|
|
|
f=a; echo "f =|$f|"
|
|
f=a; echo "f:1 =|${f:1}|"
|
|
f=a; echo "f:1:2=|${f:1:2}|"
|
|
f=a; echo "f::2 =|${f::2}|"
|
|
f=a; echo "f:1: =|${f:1:}|"
|
|
f=a; echo "f:: =|${f::}|"
|
|
|
|
f=0123456789; echo "f =|$f|"
|
|
f=0123456789; echo "f:1 =|${f:1}|"
|
|
f=0123456789; echo "f:1:2=|${f:1:2}|"
|
|
f=0123456789; echo "f::2 =|${f::2}|"
|
|
f=0123456789; echo "f:1: =|${f:1:}|"
|
|
f=0123456789; echo "f:: =|${f::}|"
|
|
|
|
echo "Substrings with expressions"
|
|
f=01234567; echo 'f '"=|$f|"
|
|
f=01234567; echo 'f:1+1:2+2 '"=|${f:1+1:2+2}|"
|
|
f=01234567; echo 'f:-1:2+2 '"=|${f:-1:2+2}|"
|
|
f=01234567; echo 'f:1:f '"=|${f:1:f}|"
|
|
f=01234567; echo 'f:1:$f '"=|${f:1:$f}|"
|
|
f=01234567; echo 'f:1:${f} '"=|${f:1:${f}}|"
|
|
f=01234567; echo 'f:1:${f:3:1} '"=|${f:1:${f:3:1}}|"
|
|
f=01234567; echo 'f:1:1`echo 1`'"=|${f:1:`echo 1`}|"
|
|
|
|
echo Done
|