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

Re: parse vs. runtime errors



On Fri, Apr 20, 2018, 11:31 AM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:

> How come:
>
> [ .... ]]
>
> is only caught as an error at runtime?


"[" is a command (synonym for "test") and not a token, and "]]" is only a
token when balanced with "[[".

  The error kills anything
> remaining on the same line


That would depend on how the remaining commands are separated from this one.

Either way, can I ask zsh to always make any error stop everything and
> make itself known?


That's what "setopt errexit" is for, although that mostly applies to
scripts rather than interactive shells.


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