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

Re: [PATCH] typeset: set $? on incidental error



On 2016-01-20 07:47:52 +0000, Daniel Shahaf wrote:
> In real-life examples, if the command subst had a non-zero exit status,
> the value would typically _not_ be the one I asked for:
> 
>     % cd $(mktemp -d)
>     % local mtime=$(zstat +mtime myfile)
>     zstat: myfile: no such file or directory

This is not specific to "local". Same expected behavior with "printf":

cventin% local mtime=$(zstat +mtime myfile)
zsh: command not found: zstat
cventin% echo $?
0
cventin% printf "%s\n" $(zstat +mtime myfile)
zsh: command not found: zstat

cventin% echo $?
0

-- 
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