mirror of
https://github.com/sheumann/hush.git
synced 2024-12-25 03:32:18 +00:00
3f78cec347
function old new delta expand_vars_to_list 2209 2229 +20 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
61 lines
1.9 KiB
Plaintext
Executable File
61 lines
1.9 KiB
Plaintext
Executable File
# do all of these in subshells since it's supposed to error out
|
|
|
|
# first try some invalid patterns
|
|
#"$THIS_SH" -c 'echo ${?}' -- this is valid as it's the same as $?
|
|
"$THIS_SH" -c 'echo ${:?}'
|
|
|
|
# then some funky ones
|
|
# note: bash prints 1 - treats it as "length of $#"? We print 0
|
|
"$THIS_SH" -c 'echo ${#?}'
|
|
# bash prints 0
|
|
"$THIS_SH" -c 'echo ${#:?}'
|
|
|
|
# now some valid ones
|
|
export msg_unset="unset!"
|
|
export msg_null_or_unset="null or unset!"
|
|
|
|
echo ====
|
|
"$THIS_SH" -c 'set --; echo _$1'
|
|
"$THIS_SH" -c 'set --; echo _${1?}'
|
|
"$THIS_SH" -c 'set --; echo _${1:?}'
|
|
"$THIS_SH" -c 'set --; echo _${1?message1}'
|
|
"$THIS_SH" -c 'set --; echo _${1:?message1}'
|
|
"$THIS_SH" -c 'set --; echo _${1?$msg_unset}'
|
|
"$THIS_SH" -c 'set --; echo _${1:?$msg_null_or_unset}'
|
|
|
|
echo ====
|
|
"$THIS_SH" -c 'set -- aaaa; echo _$1'
|
|
"$THIS_SH" -c 'set -- aaaa; echo _${1?}'
|
|
"$THIS_SH" -c 'set -- aaaa; echo _${1:?}'
|
|
"$THIS_SH" -c 'set -- aaaa; echo _${1?word}'
|
|
"$THIS_SH" -c 'set -- aaaa; echo _${1:?word}'
|
|
"$THIS_SH" -c 'set -- aaaa; echo _${1?$msg_unset}'
|
|
"$THIS_SH" -c 'set -- aaaa; echo _${1:?$msg_null_or_unset}'
|
|
|
|
echo ====
|
|
"$THIS_SH" -c 'unset f; echo _$f'
|
|
"$THIS_SH" -c 'unset f; echo _${f?}'
|
|
"$THIS_SH" -c 'unset f; echo _${f:?}'
|
|
"$THIS_SH" -c 'unset f; echo _${f?message3}'
|
|
"$THIS_SH" -c 'unset f; echo _${f:?message3}'
|
|
"$THIS_SH" -c 'unset f; echo _${f?$msg_unset}'
|
|
"$THIS_SH" -c 'unset f; echo _${f:?$msg_null_or_unset}'
|
|
|
|
echo ====
|
|
"$THIS_SH" -c 'f=; echo _$f'
|
|
"$THIS_SH" -c 'f=; echo _${f?}'
|
|
"$THIS_SH" -c 'f=; echo _${f:?}'
|
|
"$THIS_SH" -c 'f=; echo _${f?word}'
|
|
"$THIS_SH" -c 'f=; echo _${f:?message4}'
|
|
"$THIS_SH" -c 'f=; echo _${f?$msg_unset}'
|
|
"$THIS_SH" -c 'f=; echo _${f:?$msg_null_or_unset}'
|
|
|
|
echo ====
|
|
"$THIS_SH" -c 'f=fff; echo _$f'
|
|
"$THIS_SH" -c 'f=fff; echo _${f?}'
|
|
"$THIS_SH" -c 'f=fff; echo _${f:?}'
|
|
"$THIS_SH" -c 'f=fff; echo _${f?word}'
|
|
"$THIS_SH" -c 'f=fff; echo _${f:?word}'
|
|
"$THIS_SH" -c 'f=fff; echo _${f?$msg_unset}'
|
|
"$THIS_SH" -c 'f=fff; echo _${f:?$msg_null_or_unset}'
|