2009-03-29 00:25:34 +05:30
|
|
|
# do all of these in subshells since it's supposed to error out
|
|
|
|
|
|
|
|
# first try some invalid patterns
|
2009-04-01 03:44:32 +05:30
|
|
|
"$THIS_SH" -c 'echo ${?}'
|
|
|
|
"$THIS_SH" -c 'echo ${:?}'
|
2009-03-29 00:25:34 +05:30
|
|
|
|
|
|
|
# then some funky ones
|
2009-04-01 03:44:32 +05:30
|
|
|
"$THIS_SH" -c 'echo ${#?}'
|
|
|
|
"$THIS_SH" -c 'echo ${#:?}'
|
2009-03-29 00:25:34 +05:30
|
|
|
|
|
|
|
# now some valid ones
|
2009-04-01 03:44:32 +05:30
|
|
|
"$THIS_SH" -c 'set --; echo _$1'
|
|
|
|
"$THIS_SH" -c 'set --; echo _${1?}'
|
|
|
|
"$THIS_SH" -c 'set --; echo _${1:?}'
|
|
|
|
"$THIS_SH" -c 'set --; echo _${1?word}'
|
|
|
|
"$THIS_SH" -c 'set --; echo _${1:?word}'
|
2009-03-29 00:25:34 +05:30
|
|
|
|
2009-04-01 03:44:32 +05:30
|
|
|
"$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}'
|
2009-03-29 00:25:34 +05:30
|
|
|
|
2009-04-01 03:44:32 +05:30
|
|
|
"$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?word}'
|
|
|
|
"$THIS_SH" -c 'unset f; echo _${f:?word}'
|
2009-03-29 00:25:34 +05:30
|
|
|
|
2009-04-01 03:44:32 +05:30
|
|
|
"$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:?word}'
|
2009-03-29 00:25:34 +05:30
|
|
|
|
2009-04-01 03:44:32 +05:30
|
|
|
"$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}'
|