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

Re: Bug or misundertanding from my part?



    Hi Peter :)

 * Peter Stephenson <pws@xxxxxxx> dixit:
> >     The code above just prints "try list" and exits with a return
> > code of "13", but the manual says that the ALWAYS-LIST is executed
> > "Regardless of [...] return commands encountered [...]". Am I doing
> > something wrong? I'm a bit puzzled because the above works if I
> > change 'return 13' for 'false'.
> You're running this as a script, right?

    Yes.

> In that case the returns are treated
> as exits, which have an immediate effect.

    I know that, but I assumed, from the documentation, that "return"
and "exit" were handled differently in any context (even in scripts).
Couldn't a little note be added to the docs in the last part, where
the warning about "An exit command encountered in try-list [...]"
already exists. I know, I know, every zsh user should take into
account that a return-is-an-exit-in-a-script, OK, but I think that it
would be a good idea to add a little reminder O:)

> To treat returns as returns you need a function.

    OK, thanks for the information :))

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736 | http://www.dervishd.net
http://www.pleyades.net & http://www.gotesdelluna.net
It's my PC and I'll cry if I want to...



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