aboutsummaryrefslogtreecommitdiff
path: root/shell/hush_test/hush-vars/param_expand_indicate_error.tests
blob: 6b431d311493ad2703db522f82a3a7d98dcaf827 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# do all of these in subshells since it's supposed to error out

# first try some invalid patterns
hush -c 'echo ${?}'
hush -c 'echo ${:?}'

# then some funky ones
hush -c 'echo ${#?}'
hush -c 'echo ${#:?}'

# now some valid ones
hush -c 'set --; echo _$1'
hush -c 'set --; echo _${1?}'
hush -c 'set --; echo _${1:?}'
hush -c 'set --; echo _${1?word}'
hush -c 'set --; echo _${1:?word}'

hush -c 'set -- aaaa; echo _$1'
hush -c 'set -- aaaa; echo _${1?}'
hush -c 'set -- aaaa; echo _${1:?}'
hush -c 'set -- aaaa; echo _${1?word}'
hush -c 'set -- aaaa; echo _${1:?word}'

hush -c 'unset f; echo _$f'
hush -c 'unset f; echo _${f?}'
hush -c 'unset f; echo _${f:?}'
hush -c 'unset f; echo _${f?word}'
hush -c 'unset f; echo _${f:?word}'

hush -c 'f=; echo _$f'
hush -c 'f=; echo _${f?}'
hush -c 'f=; echo _${f:?}'
hush -c 'f=; echo _${f?word}'
hush -c 'f=; echo _${f:?word}'

hush -c 'f=fff; echo _$f'
hush -c 'f=fff; echo _${f?}'
hush -c 'f=fff; echo _${f:?}'
hush -c 'f=fff; echo _${f?word}'
hush -c 'f=fff; echo _${f:?word}'