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

Re: command substitution: zsh waits until command exits

On 2007-12-03 19:15:10 -0800, Bart Schaefer wrote:
> 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 think that a shell error would be a bug anyway, as POSIX defines the
case where no command name results. I think that my interpretation is
correct, as neither bash, dash or ksh93 produces a shell error, while
they produce a shell error for "&& echo true".

BTW, I suppose that if one wants to run a command FOO=bar using $PATH,
one can type:

  $(true) FOO=bar

Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)

Messages sorted by: Reverse Date, Date, Thread, Author