Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: skip command from debug trap
- X-seq: zsh-workers 25404
- From: Stephane Chazelas <Stephane_Chazelas@xxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: PATCH: skip command from debug trap
- Date: Wed, 6 Aug 2008 15:59:17 +0100
- Cc: Zsh hackers list <zsh-workers@xxxxxxxxxx>
- In-reply-to: <080806072236.ZM14655@xxxxxxxxxxxxxxxxxxxxxx>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <27237.1217946438@xxxxxxx> <6cd6de210808051647k17f14902nce840ca3edd6ddb@xxxxxxxxxxxxxx> <20080806104716.44647a75@news01> <080806072236.ZM14655@xxxxxxxxxxxxxxxxxxxxxx>
On Wed, Aug 06, 2008 at 07:22:36AM -0700, Bart Schaefer wrote:
[...]
> x=3
> return --x
>
> returns "2". How are you going to make any kind of option parsing for
> return behave compatibly with that?
See for instance kill(1). To kill a process group, you have to
do:
kill -- -<pid>
So you'd have to do
return -- -3
> } (In fact, the lack of option parsing, even --, in return is strictly a
> } bug, so this even makes it more compatible with other shells.)
>
> It'd have to be only in emulation mode, then.
-- is not a valid math expression, so changing return -- so that
it is the same as "return" instead of giving an error message
shouldn't be a problem.
Changing return -1 so that it outputs an error message instead
of returning with $? == -1 could break existing scripts.
BTW, is this:
$ zsh -c '(){echo test;return 1}; echo $?'
test
0
the expected output?
--
Stéphane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author