Something like typeset would be an advantage, as you say, if one
could activate it from the environment, as the OP tried to achieve.

Even worse, typeset -ft seems to work only on functions already
defined, so that you cannot just add it at conveniently at the top
of the script, rather you have to put that code after the function
definition and before you use the function; so most inconvenient
(without further hacks).

ksh option letter -X is still free; maybe that could be an extension
(in some future version) to activate trace for the whole ksh code
including functions?


----------------------------------------
> Date: Fri, 3 Feb 2012 13:34:08 +0100
> From: [email protected]
> To: [email protected]
> Subject: Re: [ast-users] [ksh93] Global `set -x' ? - tracing functions
>
>
> You can still trace individual functions using
>
> typeset -tf FNAME
>
> for functions defined with the
>
> function FNAME { ...
>
> syntax.
>
> Advantage - this reduces clutter, as you only see the detail you want.
>
> Drawback - To toggle tracing, or trace different functions, you need to
> edt your code.
>
> (Or add a -X f1[,f2,[...]] option to your script and add a routine to
> add a typeset -tf fN for each function specified in your 'main')
>
> Cheers,
> Henk
>
>
>
> Clark J. Wang:
> > With bash, `set -x' is global so users can debug a script by `bash -x
> > foo.sh' and every function will be traced. But with ksh, `set -x' does not
> > affect functions defined in the `function NAME' syntax which I think is not
> > convenient. Seems like ksh treats `set -x' the same way as a trap.
> >
> > Example:
> >
> > $ cat foo.sh
> > function f1 { echo f1; }
> > function f2 { echo f2; }
> > f1
> > f2
> > $ bash -x foo.sh
> > + f1
> > + echo f1
> > f1
> > + f2
> > + echo f2
> > f2
> > $ ksh -x foo.sh
> > + f1
> > f1
> > + f2
> > f2
> > $
> >
> >
> >
> >
> > _______________________________________________
> > ast-users mailing list
> > [email protected]
> > https://mailman.research.att.com/mailman/listinfo/ast-users
>
> _______________________________________________
> ast-users mailing list
> [email protected]
> https://mailman.research.att.com/mailman/listinfo/ast-users
                                          
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to