3 4
5 6 7 8 9
7 8 9
/usr/chet
/usr/chet
/usr/chet
/a/b/c
/usr/chet
/usr/chet 7
/a/b/c 9 /a/b/c
/a/b/c 9 /a/b/c
/a/b/c /a/b/c
1 2
1 1
unset
toronto airport
AVAR
song by rush
BVAR
toronto airport
AVAR
AVAR
42
/bin:/usr/bin:/usr/local/bin:.
avar=([0]="/bin:/usr/bin:/usr/local/bin:.")
z=yy
42
declare -i ivar="10"
unset
declare -x ivar="42"
hB
braceexpand:hashall:interactive-comments
hBP
braceexpand:hashall:interactive-comments:physical
declare -r SHELLOPTS="braceexpand:hashall:interactive-comments:physical"
abcde
20
30
40
50
|0|10|
10
|0|10|
10
|0|10|
10
|4|
4
|0|11|
after fff3: x=4
|0|12|
|y|
|y|
a:b:c:d
a-b-c-d
a:b:c:d
g: , 
f: , 
FIN: asdf fdsa, asdf fdsa
g: v = , w =
f: v = , w =
FIN: v = two, w = one
./varenv4.sub: line 54: bbb: unique: cannot convert indexed to associative array
after bbb: 1
declare -Ar FOOBAR=([foo]="bar" )
declare -Ar FOOBAR=([foo]="bar" )
declare -ar FOOBAR2=([0]="bar")
declare -ar FOOBAR2=([0]="bar")
F OUTSIDE
F OUTSIDE
declare -ar outside=()
declare -ir outside1="1"
tempenv = foo
0
declare -ar myvar=([0]="0")
1
declare -ir myvar="1"
declare -rx tempvar1='foo'
declare -rx tempvar2='qux'
./varenv7.sub: line 44: local: var: readonly variable
inside: outside
outside: outside
local: unset1 unset2
abc
abc
:1
:2
after: ----
global:1
global:2
after: --global--
after: ----
x = :1:2
in o1 (readonly modifying local scalars):
declare -r i1="a b c"
declare -r j1="1 2 3"
after o1:
./varenv9.sub: line 15: declare: i1: not found
./varenv9.sub: line 15: declare: j1: not found
in o2 (readonly setting global scalars):
declare -r i2="a b c"
declare -r j2="1 2 3"
after o2:
declare -r i2="a b c"
declare -r j2="1 2 3"
./varenv9.sub: line 33: unset: i2: cannot unset: readonly variable
./varenv9.sub: line 33: unset: j2: cannot unset: readonly variable
in o3 (readonly modifying locals, converting to arrays):
declare -ar i3=([0]="a" [1]="b" [2]="c")
declare -ar j3=([0]="1" [1]="2" [2]="3")
after o3:
./varenv9.sub: line 48: declare: i3: not found
./varenv9.sub: line 48: declare: j3: not found
in o4 (readonly setting global array variables):
declare -ar i4=([0]="a" [1]="b" [2]="c")
declare -ar j4=([0]="1" [1]="2" [2]="3")
after o4:
declare -ar i4=([0]="a" [1]="b" [2]="c")
declare -ar j4=([0]="1" [1]="2" [2]="3")
./varenv9.sub: line 66: unset: i4: cannot unset: readonly variable
./varenv9.sub: line 66: unset: j4: cannot unset: readonly variable
main: unset
inner: res unset
outer: res: X Y
main: after first call: X
inner: X
outer: res: X Y
main: after second call: X
func: null or unset
after func: x = outside
./varenv11.sub: line 4: local: qux: readonly variable
./varenv11.sub: line 5: qux: readonly variable
declare -A foo=([one]="one" [zero]="zero" )
declare -a bar=([0]="zero" [1]="one")
declare -A foo=([one]="one" [zero]="zero" )
declare -a bar=([0]="zero" [1]="one")
./varenv11.sub: line 29: a: readonly variable
foo=abc
func1: var =

func1: var =

inside: declare -- foo
outside:
declare -x foo="abc"
inside: declare -x var="value"
outside: declare -- var="one"
inside: declare -- var="local"
outside: declare -x var="global"
a=z
a=b
a=z
