Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: command substitution: zsh waits until command exits
- X-seq: zsh-users 12281
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: command substitution: zsh waits until command exits
- Date: Mon, 03 Dec 2007 19:15:10 -0800
- In-reply-to: <20071204014227.GE5855@xxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20071130133943.GG5855@xxxxxxxxxxxxxxxxxxx> <071130073719.ZM18090@xxxxxxxxxxxxxxxxxxxxxx> <20071130163155.GL5855@xxxxxxxxxxxxxxxxxxx> <071130185827.ZM18402@xxxxxxxxxxxxxxxxxxxxxx> <20071202021652.GO5855@xxxxxxxxxxxxxxxxxxx> <071201210744.ZM20044@xxxxxxxxxxxxxxxxxxxxxx> <20071202152254.GP5855@xxxxxxxxxxxxxxxxxxx> <071202102717.ZM2757@xxxxxxxxxxxxxxxxxxxxxx> <20071203011131.GT5855@xxxxxxxxxxxxxxxxxxx> <071203092626.ZM4367@xxxxxxxxxxxxxxxxxxxxxx> <20071204014227.GE5855@xxxxxxxxxxxxxxxxxxx>
On Dec 4, 2:42am, Vincent Lefevre wrote:
}
} Now, if I understand correctly,
}
} $(false) && echo true
}
} shouldn't output anything because before the &&, there's no command
} and the command substitution has a non-zero exit status.
I would have expected this to produce a shell error of some kind as
there's no command at all to the left of the "&&". Given that it
does not, I'd say not using the exit status of $(false) is a bug.
I suspect that what's happening is that zsh is losing the exit status
on its way from step 2 to step 4 of the expansion sequence I quoted
previously. There is no exit status from expanding the non-existent
parameter assignment expressions, so 0 is returned.
This works (i.e., prints nothing and returns 1):
TRUE=$(false) && echo true
While we're on the subject of empty command words ...
if ; then echo ok; fi
... does not produce a syntax error in zsh and also prints "ok". It
may be there's a relationship there.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author