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

Re: [PATCH] don't exit shell on [[ -o invalid@option ]]



On Nov 10,  6:24pm, Martijn Dekker wrote:
}
} Does it make sense for [[ -o invalid@option ]] to exit the shell with an
} error message?

I have the impression that this was discussed on the list before, some
time ago, and the conclusion was that it was useful to be able to tell
[[ -o an_option_typo ]] apart from [[ -o an_unset_option ]].

In other words, if the option doesn't exist at all, then for any code
depending on the result of the test, both the true and false branches
may very well be wrong.

It's easy enough to write backwards-compatible code by simply adding a
subshell around the test, if that's what's intended.

We could certainly suppress the error in emulation modes given that's
what other shells do.  Further, I'm not strongly invested in the current
behavior even for native mode, but we should consider the ramifications.



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