Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] typeset: set $? on incidental error
- X-seq: zsh-workers 37719
- From: Vincent Lefevre <vincent@xxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [PATCH] typeset: set $? on incidental error
- Date: Thu, 21 Jan 2016 15:22:01 +0100
- In-reply-to: <20160120074752.GB29602@tarsus.local2>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mail-followup-to: zsh-workers@xxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20160114001336.GA11173@tarsus.local2> <56973114.90807@gmx.com> <20160115062645.GB12223@tarsus.local2> <CAHYJk3QLCCVmZf4efzQgxs3haKv2mssQk3cGQXd5fm7DK7dgGg@mail.gmail.com> <20160118022557.GE3979@tarsus.local2> <CAHYJk3T6hkQez_zUsRKngRoAm80Xr5Od-=51KWGf9bRWkmRqaA@mail.gmail.com> <20160120074752.GB29602@tarsus.local2>
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