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

Re: Feature request: ZSH_XTRACEFD variable

2020-05-03 00:06:58 +0000, Daniel Shahaf:
> P.S. Shouldn't ZSH_XTRACEFD be declared with PM_DONTIMPORT?

(assuming PM_DONTIMPORT is about not importing it from the

ZSH_XTRACEFD is useful in things like:

ZSH_XTRACEFD=7 zsh -x myscript 7> somefile


ZSH_XTRACEFD=7 zsh -lx 7> somefile

to debug start-up file issues.

That's the primary way I've been using its bash counterpart.
for several examples.

bash also allows

SHELLOPTS=xtrace BASH_XTRACEFD=7 some-command

Which will cause all bash invocations run through some-command
(including those running as sh!) to have their xtrace option
set. I've used that to debug things like grub-install.

I don't think we want to go there with zsh. With zsh, one can
always add a:

if [[ -n $MYDEBUG ]]; then
  set -o xtrace

to their ~/.zshenv to enable this kind of debugging.


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