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

Re: return builtin to end a script



> On 16/02/2024 12:58 GMT Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> 
>  
> The return builtin is currently specified only for shell functions
> and "." scripts, while it would also be useful to end a script,
> for instance to be able to use zsh script both as commands (e.g.
> from non-zsh shells) and as autoloaded functions in zsh.
> 
> So I think that it would be useful to extend it to end a script.

I remember adding this a long time ago now.

% zsh <<<'echo Hello
quote> return
quote> echo Goodbye'
Hello

It looks like the documentation is defective.

pws




> 
> -- 
> Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




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