Lines Matching defs:foo

36 	nameref foo=$1 bar=$2
37 if [[ $foo != $bar ]]
38 then err_exit "foo=$foo != bar=$bar"
40 foo=hello
41 if [[ $foo != $bar ]]
42 then err_exit "foo=$foo != bar=$bar"
44 foo.child=child
45 if [[ ${foo.child} != ${bar.child} ]]
46 then err_exit "foo.child=${foo.child} != bar=${bar.child}"
54 .foo=top
55 .foo.bar=next
56 checkref .foo.bar .foo.bar
57 if [[ ${.foo.bar} != hello ]]
58 then err_exit ".foo.bar=${.foo.bar} != hello"
60 if [[ ${.foo.bar.child} != child ]]
61 then err_exit ".foo.bar.child=${.foo.bar.child} != child"
83 nameref x=.foo.bar
84 if [[ ${!x} != .foo.bar ]]
89 nameref x=.foo.bar
94 if [[ $(.foo.bar.set) != $(x.set) ]]
100 if [[ $(typeset -n) != x=.foo.bar ]]
104 typeset +n foo bar 2> /dev/null
105 unset foo bar
106 export bar=foo
107 nameref foo=bar
108 if [[ $foo != foo ]]
109 then err_exit "value of nameref foo != $foo"
112 print -r -- $foo
123 typeset +n foo bar
124 unset foo bar
125 set foo
127 foo=hello
131 unset foo bar
135 typeset -n foo=bar
136 typeset -n foo=bar
164 unset -n x foo bar
165 if [[ $(nameref x=foo;for x in foo bar;do print ${!x};done) != $'foo\nbar' ]]
179 var=(foo=bar)
193 foo=( integer bar=0)
194 setval foo 5
195 (( foo.bar == 5)) || err_exit 'nested nameref not working'
205 typeset -n foo=$1
206 print -r -- ${foo.a}
224 foo=(x=hi)
230 i=foo
232 unset -n foo bar
233 typeset -A foo
234 foo[x.y]=(x=3 y=4)
235 nameref bar=foo[x.y]
237 [[ ${!bar} == 'foo[x.y]' ]] || err_exit '${!var} not correct for nameref to an array instance'
239 nameref bar=foo
240 [[ ${!bar} == foo ]] || err_exit '${!var} not correct for nameref to array variable'
241 $SHELL -c 'function bar { nameref x=foo[++];};typeset -A foo;bar' 2> /dev/null ||err_exit 'nameref of associative array tries to evaluate subscript'
242 i=$($SHELL -c 'nameref foo=bar; bar[2]=(x=3 y=4); nameref x=foo[2].y;print -r -- $x' 2> /dev/null)
250 function foo
252 typeset var=( foo=hello)
255 foo
257 ) == *foo=hello* ]] || err_exit 'unable to display compound variable from name reference of local variable'
261 i=\\$c;typeset -A a; a[\$i]=foo;typeset -n x=a[\$i]; print "\$x"
263 ) != foo ]] && err_exit 'nameref x=a[$c] '"not working for c=$c"
267 i=\\$c;typeset -A a; a[\$i]=foo;b=a[\$i];typeset -n x=\$b; print "\$x"
269 ) != foo ]] && err_exit 'nameref x=$b with b=a[$c] '"not working for c=$c"
272 unset -n foo x
273 unset foo x
274 typeset -A foo
275 nameref x=foo[xyz]
276 foo[xyz]=ok
292 unset foo bar
295 for i in foo bar
300 foo=1 bar=2;a) == $'1\n2' ]] 2> /dev/null || err_exit 'nameref in pipeline broken'
310 typeset +n bam zip foo
311 unset bam zip foo
312 typeset -A foo
313 foo[2]=bar
314 typeset -n bam=foo[2]
340 typeset -n ref=fvar.foo
375 var.foo=bar
382 [[ $container == *foo=bar* ]] || err_exit 'name references to static compound variables in parent scope not working'
389 var.foo=bar
393 typeset foo
400 [[ $container == *foo=bar* ]] || err_exit 'name references to static type variables in parent scope not working'
407 nameref node=var.foo
416 [[ $container == *foo=bar* ]] || err_exit 'name reference to a name reference variable in a function not working'
438 $SHELL 2> /dev/null -c 'nameref foo=bar; typeset -A foo; (( (x=foo[a])==0 ))' || err_exit 'references inside arithmetic expressions not working'
663 yy foo
664 unset foo
665 [[ $foo ]] && err_exit 'unset after creating via nameref in function not working'
677 nameref var=$1.foo
687 [[ $args == *foo=bam* ]] || err_exit 'nameref does not bind to correct scope'