blob: 11b392744a1762abea5a183621443a7cff9f742a [file] [log] [blame]
Denys Vlasenkob28d4c32017-07-25 16:29:36 +02001# check invalid options are rejected
2# bash: in posix mode, aborts if non-interactive; using subshell to avoid that
3(unset -)
4echo $?
5(unset -m a b c)
6echo $?
7
8# check funky usage
9unset
10echo $?
11
12# check normal usage
13echo ___
14f=f g=g
15echo $? $f $g
16unset f
17echo $? $f $g
18unset g
19echo $? $f $g
20
21echo ___
22f=f g=g
23echo $? $f $g
24unset f g
25echo $? $f $g
26f=f g=g
27echo $? $f $g
28unset -v f g
29echo $? $f $g
30
31# check read only vars
32echo ___
33f=f g=g
34VAR_RO=1
35readonly VAR_RO
36(unset VAR_RO)
37echo $? $f $g
38# not testing "do variables survive error halfway through unset" since unset aborts
39# unset f VAR_RO g
40#echo $? $f $g