Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.unix.shell > #4874
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!nntp.club.cc.cmu.edu!feeder.erje.net!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!xlned.com!feeder1.xlned.com!zen.net.uk!hamilton.zen.co.uk!reader03.nrc01.news.zen.net.uk.POSTED!not-for-mail |
|---|---|
| Newsgroups | comp.unix.shell |
| From | Geoff Clare <geoff@clare.See-My-Signature.invalid> |
| Subject | Re: [zsh] How to mimic errexit within subshell (or function)? |
| References | <jnpk36$jqs$1@reader1.panix.com> <20120502063438.GA10446@chaz.gmail.com> |
| User-Agent | XPN/1.2.6 (Street Spirit ; Linux) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=US-ASCII |
| Content-Transfer-Encoding | 7bit |
| Date | Wed, 2 May 2012 13:51:59 +0100 |
| Message-ID | <f8n779-hk5.ln1@leafnode-msgid.gclare.org.uk> (permalink) |
| Lines | 39 |
| Organization | Zen Internet |
| NNTP-Posting-Host | a70bad5c.news.zen.co.uk |
| X-Trace | DXC=_G`o44olFYRoS>6CUf2S_]f2FgniPJjgR=dR0\ckLKGPWeZ<[7LZNRVEZ1f0h7L>b]4CJ\2i>aFoT>P83MgUBGaZA[N@^L_U=2Y |
| X-Complaints-To | abuse@zen.co.uk |
| Xref | csiph.com comp.unix.shell:4874 |
Show key headers only | View raw
Stephane Chazelas wrote:
> 2012-05-01 21:20:38 +0000, kj:
>>
>> The following scheme doesn't work as expected: despite the set -e
>> (errexit), the subshell does not exit on error (it just goes on to
>> execute the next command):
>>
>> #!/usr/bin/zsh
>> (
>> set -e
>> cmd0...
>> cmd1...
>> cmd2...
>> ...
>> echo "$0: done"
>> ) || { echo "$0: failed" && exit 1 }
> Try
>
> zsh -ec '
> cmd1
> cmd2...
> ' || ...
Or try
(
set -e
cmd1
cmd2...
)
test $? -eq 0 || ...
(I don't have zsh, but that works in ksh, bash and dash).
--
Geoff Clare <netnews@gclare.org.uk>
Back to comp.unix.shell | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[zsh] How to mimic errexit within subshell (or function)? kj <no.email@please.post> - 2012-05-01 21:20 +0000
Re: [zsh] How to mimic errexit within subshell (or function)? Stephane Chazelas <stephane.chazelas@gmail.com> - 2012-05-02 07:34 +0100
Re: [zsh] How to mimic errexit within subshell (or function)? Geoff Clare <geoff@clare.See-My-Signature.invalid> - 2012-05-02 13:51 +0100
Re: [zsh] How to mimic errexit within subshell (or function)? Stephane Chazelas <stephane.chazelas@gmail.com> - 2012-05-02 14:29 +0100
Re: [zsh] How to mimic errexit within subshell (or function)? kj <no.email@please.post> - 2012-05-02 19:33 +0000
Re: [zsh] How to mimic errexit within subshell (or function)? Stephane Chazelas <stephane.chazelas@gmail.com> - 2012-05-02 20:53 +0100
Re: [zsh] How to mimic errexit within subshell (or function)? Martin Vaeth <vaeth@mathematik.uni-wuerzburg.de> - 2012-05-02 10:30 +0000
Re: [zsh] How to mimic errexit within subshell (or function)? kj <no.email@please.post> - 2012-05-02 19:09 +0000
Re: [zsh] How to mimic errexit within subshell (or function)? kj <no.email@please.post> - 2012-05-02 19:12 +0000
Re: [zsh] How to mimic errexit within subshell (or function)? Stephane Chazelas <stephane.chazelas@gmail.com> - 2012-05-02 20:27 +0100
Re: [zsh] How to mimic errexit within subshell (or function)? kj <no.email@please.post> - 2012-05-03 18:20 +0000
csiph-web