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

Re: Feature request: a new warning option

On Tue, Oct 8, 2019 at 9:03 PM Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
> The warning would be triggered when:
> - a an || would occur after an instruction preceded by &&,
> - the instruction wouldn't be an always-true instruction

To add to what's already been bandied about:

This seems like something better suited for a shell script "lint" type
program, rather than something to emit as a run-time warning from the
shell itself.  There's also the question of when this warning would be
emitted; if at execute time, is it really doing anything useful?  If
at parse time, the parser has to become aware of even more semantics.

Creation of global variables and references to unset variables can't
really be detected by syntax examination, but all the cases the shell
could successfully warn about in this scheme are, I think, resolvable
by looking at the individual pipelines.  If you want a runtime
warning, maybe do something with ${(z)ZSH_DEBUG_CMD} in a TRAPDEBUG

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