Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug#310872: zsh can't be a ksh replacement (can't trap ERR).



Hi,

Bart Schaefer a écrit :
>
> Zsh does not provide an ERR trap because some platforms on which zsh can be
> compiled actually have SIGERR defined, which is a real OS-level signal and
> not interchangeable with the ksh et al. use of ERR as a magic trap.
>
> The zsh equivalent is
>
> 	trap 'echo alert-an-error-occured' ZERR
Don't you think it's strange to trap a Zsomething in Ksh ??

>
> A possible workaround would be
>
> 	(( $signals[(I)ERR] )) || alias -g ERR=ZERR
>
Waow ! That's knowing zsh !

But, If i keep zsh as ksh
I have to rewrite every script to put this workaround in.

On the other hand, if I ever run the modified script with the more
traditionnal ksh, the workaround fails.

So, for this particular problem of trap ERR, there are only problems
in using zsh as a ksh, at least on platform where ksh ERR does not
conflict with OS SIGERR. (By the way, what are the platform with OS
SIGERR ? And do some ksh run on them ?)

	Regards,
	Christophe
-- 
char*p="c+)1+)I1+++(Y1)I1)1)I1)19Y(QII1)1)I1)19Q(K)K+)I1+9I(a)I1)II1))AA(91)I\
1)II1)199(3+)1)K+)19;(";main(_){while(*p){for(_=*p-32>>3;_;--_)putchar(' ');
if (!(_=*p++-32&7))putchar('\n');else while(_--)printf("_/");}}



Messages sorted by: Reverse Date, Date, Thread, Author