source: MondoRescue/branches/2.2.9/mindi-busybox/shell/hush_test/hush-vars/param_expand_indicate_error.tests@ 2725

Last change on this file since 2725 was 2725, checked in by Bruno Cornec, 13 years ago
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
  • Property svn:executable set to *
File size: 1.9 KB
Line 
1# do all of these in subshells since it's supposed to error out
2
3# first try some invalid patterns
4#"$THIS_SH" -c 'echo ${?}' -- this is valid as it's the same as $?
5"$THIS_SH" -c 'echo ${:?}'
6
7# then some funky ones
8# note: bash prints 1 - treats it as "length of $#"? We print 0
9"$THIS_SH" -c 'echo ${#?}'
10# bash prints 0
11"$THIS_SH" -c 'echo ${#:?}'
12
13# now some valid ones
14export msg_unset="unset!"
15export msg_null_or_unset="null or unset!"
16
17echo ====
18"$THIS_SH" -c 'set --; echo _$1'
19"$THIS_SH" -c 'set --; echo _${1?}'
20"$THIS_SH" -c 'set --; echo _${1:?}'
21"$THIS_SH" -c 'set --; echo _${1?message1}'
22"$THIS_SH" -c 'set --; echo _${1:?message1}'
23"$THIS_SH" -c 'set --; echo _${1?$msg_unset}'
24"$THIS_SH" -c 'set --; echo _${1:?$msg_null_or_unset}'
25
26echo ====
27"$THIS_SH" -c 'set -- aaaa; echo _$1'
28"$THIS_SH" -c 'set -- aaaa; echo _${1?}'
29"$THIS_SH" -c 'set -- aaaa; echo _${1:?}'
30"$THIS_SH" -c 'set -- aaaa; echo _${1?word}'
31"$THIS_SH" -c 'set -- aaaa; echo _${1:?word}'
32"$THIS_SH" -c 'set -- aaaa; echo _${1?$msg_unset}'
33"$THIS_SH" -c 'set -- aaaa; echo _${1:?$msg_null_or_unset}'
34
35echo ====
36"$THIS_SH" -c 'unset f; echo _$f'
37"$THIS_SH" -c 'unset f; echo _${f?}'
38"$THIS_SH" -c 'unset f; echo _${f:?}'
39"$THIS_SH" -c 'unset f; echo _${f?message3}'
40"$THIS_SH" -c 'unset f; echo _${f:?message3}'
41"$THIS_SH" -c 'unset f; echo _${f?$msg_unset}'
42"$THIS_SH" -c 'unset f; echo _${f:?$msg_null_or_unset}'
43
44echo ====
45"$THIS_SH" -c 'f=; echo _$f'
46"$THIS_SH" -c 'f=; echo _${f?}'
47"$THIS_SH" -c 'f=; echo _${f:?}'
48"$THIS_SH" -c 'f=; echo _${f?word}'
49"$THIS_SH" -c 'f=; echo _${f:?message4}'
50"$THIS_SH" -c 'f=; echo _${f?$msg_unset}'
51"$THIS_SH" -c 'f=; echo _${f:?$msg_null_or_unset}'
52
53echo ====
54"$THIS_SH" -c 'f=fff; echo _$f'
55"$THIS_SH" -c 'f=fff; echo _${f?}'
56"$THIS_SH" -c 'f=fff; echo _${f:?}'
57"$THIS_SH" -c 'f=fff; echo _${f?word}'
58"$THIS_SH" -c 'f=fff; echo _${f:?word}'
59"$THIS_SH" -c 'f=fff; echo _${f?$msg_unset}'
60"$THIS_SH" -c 'f=fff; echo _${f:?$msg_null_or_unset}'
Note: See TracBrowser for help on using the repository browser.