one two three declare -n fee="flip" declare -n foo="bar" turning off nameref attribute on foo bar after +n foo bar = other one two one expect argv[1] = expect argv[1] = expect one expect one expect argv[1] = changevar: expect argv[1] = expect argv[1] = changevar: expect argv[1] = expect argv[1] = ./nameref.tests: line 93: bar: readonly variable ./nameref.tests: line 94: foo: readonly variable one one ./nameref.tests: line 106: foo: readonly variable ./nameref.tests: line 103: foo: readonly variable one abxde abxde one bar ./nameref2.sub: line 5: foo: readonly variable expect argv[1] = expect argv[1] = expect argv[1] = expect argv[1] = ./nameref3.sub: line 21: unset: bar: cannot unset: readonly variable expect two expect two three unset four 0 expect a b expect foo 1 3 5 7 9 9 1 3 42 7 9 1 3 42 7 9 9 1 3 44 7 9 unset expect argv[1] = expect argv[1] = argv[2] = argv[3] = argv[4] = argv[5] = 16 expect <4> 4 expect <4> 4 expect <4> 4 expect one expect one expect one expect four errors = 0 1 2 v1: 1 v2: 2 ref -> first, value: I am first ref -> second, value: I am in the middle ref -> third, value: I am last final state: ref -> third, value: I am last ref -> one, value: 1 ref -> two, value: 2 ref -> three, value: 3 final state: ref -> three, value: 3 ./nameref5.sub: line 43: unset: three: cannot unset: readonly variable ref -> one, value: 1 ref -> two, value: 2 ref -> three, value: 3 final state: ref -> three, value: 3 ./nameref6.sub: line 2: typeset: x: nameref variable self references not allowed ./nameref6.sub: line 12: typeset: x: reference variable cannot be an array the -- 1 42 -- 0 y -- 0 2 -- 0 2 -- 0 y -- 0 bar unset inside inside: two outside: foo local ./nameref8.sub: line 47: typeset: v: nameref variable self references not allowed ./nameref8.sub: line 54: warning: x: circular name reference ./nameref8.sub: line 55: warning: x: circular name reference x = idx2 idX2 idx2 idX2 declare -n foo="x[\$zero]" 42 declare -a x=([0]="4") declare -n foo="x[\$(echo 0)]" 4 comsub x[i=0] comsub 4 comsub 4 comsub 4 declare -n foo="somevariable" ./nameref10.sub: line 38: typeset: somevariable: not found foo = declare -n foo="somevariable" declare -A somevariable=([jug]="brown" ) ./nameref10.sub: line 45: warning: foo=([jug]="brown" ): quoted compound array assignment deprecated declare -n foo="somevariable" declare -A somevariable=([jug]="brown" ) declare -n foo="somevariable" ./nameref10.sub: line 49: typeset: somevariable: not found ./nameref10.sub: line 51: typeset: foo: not found ./nameref10.sub: line 51: typeset: somevariable: not found declare -n foo="bar" ./nameref10.sub: line 55: typeset: bar: not found declare -n foo="bar" ./nameref10.sub: line 57: typeset: bar: not found declare -n foo="bar" declare -i bar="8" 8 declare -n foo="bar" ./nameref10.sub: line 64: typeset: bar: not found