Subject: Re: [ast-users] Is it correct that exporting function-local variable
causes the variable not to be exported if the function exporting the local
variable calls another function and this function calls an external command ?
--------
> ksh93 -c 'function y { ksh -c "print \$ex" ; } ; function x {
> typeset -x ex ; for ex in "foo" "bar" ; do export ex ; y ; done ; } ;
> x'
>
With ksh93, variables are statically scoped whereas they are
dynamically scoped in ksh88.
Thus, since you have
typeset -x ex
in function x, this creates a local variable in x that will not
be seen in function y.
However, if you omit the typeset -x ex in function x and only
have export ex, then ex will be a global variable that is
exported and will therefore be known in function y.
Thus, this behavior is correct.
David Korn
[email protected]
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users