ksh doesn't show trace in fuctions

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ksh doesn't show trace in fuctions

Han Boetes
Hi,

~$ proc(){
> ls foo
> }
~$ set -x
~$ proc
+ proc
ls: foo: No such file or directory
~$

Now compare this with for example zsh:

~% proc(){
function> ls foo
function> }
~% set -x
~% proc
+zsh:5> proc
+proc:1> ls -pb '--color=auto' '--time-style=local' foo
ls: foo: No such file or directory

I think it's really practical to have traceoutput in functions. So
I would like to request that ksh will show traceoutput in
functions as well.



# Han

Reply | Threaded
Open this post in threaded view
|

Re: ksh doesn't show trace in fuctions

Thorsten Glaser-3
Han Boetes dixit:

>Hi,
>
>~$ proc(){
>> ls foo
>> }
>~$ set -x
>~$ proc
>+ proc
>ls: foo: No such file or directory
>~$

tg@odem:/home/tg $ function proc
> {
>         ls foo
> }
tg@odem:/home/tg $ proc
ls: foo: No such file or directory
tg@odem:/home/tg $ typeset -ft proc
tg@odem:/home/tg $ proc
+ ls foo
ls: foo: No such file or directory
tg@odem:/home/tg $


HTH,
//mirabile
--
I believe no one can invent an algorithm. One just happens to hit upon it
when God enlightens him. Or only God invents algorithms, we merely copy them.
If you don't believe in God, just consider God as Nature if you won't deny
existence. -- Coywolf Qi Hunt

Reply | Threaded
Open this post in threaded view
|

Re: ksh doesn't show trace in fuctions

Han Boetes
In reply to this post by Han Boetes
Thank you Thorsten!

     Functions can have two attributes, ``trace'' and ``export'', which can be
     set with typeset -ft and typeset -fx, respectively.  When a traced func-
     tion is executed, the shell's xtrace option is turned on for the func-
     tion's duration; otherwise, the xtrace option is turned off.  The
     ``export'' attribute of functions is currently not used.  In the original
     Korn shell, exported functions are visible to shell scripts that are exe-
     cuted.



# Han