implement `unset` semantics as required by POSIX
[oweals/busybox.git] / shell / hush_test / hush-vars / param_expand_assign.tests
1 # first try some invalid patterns (do in subshell due to parsing error)
2 hush -c 'echo ${=}'
3 hush -c 'echo ${:=}'
4
5 # now some funky ones
6 hush -c 'echo ${#=}'
7 hush -c 'echo ${#:=}'
8
9 # should error out
10 hush -c 'set --; echo _${1=}'
11 hush -c 'set --; echo _${1:=}'
12 hush -c 'set --; echo _${1=word}'
13 hush -c 'set --; echo _${1:=word}'
14
15 # should not error
16 hush -c 'set aa; echo _${1=}'
17 hush -c 'set aa; echo _${1:=}'
18 hush -c 'set aa; echo _${1=word}'
19 hush -c 'set aa; echo _${1:=word}'
20
21 # should work fine
22 unset f; echo _$f
23 unset f; echo _${f=}
24 unset f; echo _${f:=}
25 unset f; echo _${f=word}
26 unset f; echo _${f:=word}
27
28 f=; echo _$f
29 f=; echo _${f=}
30 f=; echo _${f:=}
31 f=; echo _${f=word}
32 f=; echo _${f:=word}
33
34 f=fff; echo _$f
35 f=fff; echo _${f=}
36 f=fff; echo _${f:=}
37 f=fff; echo _${f=word}
38 f=fff; echo _${f:=word}