cc: [EMAIL PROTECTED]
Subject: Re: [ast-developers] Option -x lost in discipline function
--------
> In the following script, when str.a.get returns, option -x is unset:
>
> ---------------------------------------------------------
> function f
> {
> typeset x y
>
> set -x
> print start
> x=${str.a}
> print "$x"
> print end
> }
>
> __a=foo
>
> str=(typeset a)
>
> function str.a.get
> {
> .sh.value=$__a
> }
>
> f
> ---------------------------------------------------------
>
> Output:
>
> + print start
> start
> x=foo
> foo
> end
>
> This appears to happen only within a function. If the f call is replaced
> by the function body, the output is as expected.
>
> Regards,
> Bernd
>
> --
> Bernd Eggink
> http://sudrala.de
function name{...} provides a separate scope for the -x option.
name(){...} does not. if you want to have a function that enables
-x for the caller with function name{...}, use
trap 'set -x' EXIT
inside the function since EXIT traps is function name{...} are
executed in the scope of the caller.
David Korn
[EMAIL PROTECTED]
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers