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

Re: Suppress tracing of "set +x"



2015-12-30 16:30:32 +0100, Martijn Dekker:
> Dominik Vogt schreef op 30-12-15 om 11:45:
> > "set -x" is very handy when printing commands from buils scripts
> > and such, but what really annoys me is that the final "set +x"
> > that ends tracing is also printed.  Is there really no way to
> > suppress tracing of this specific command?
> 
> { set +x; } 2>/dev/null
[...]

You can also enable set -x in a subshell only:

(
  set -x
  cmd1 traced
  cmd2 traced
)
cmd3 not traced

Or using an anynymous function:

(){
  setopt localoptions xtrace
  cmd1 traced
  cmd2 traced
}
cmd3 not traced

That affects the PS4 display though.

-- 
Stephane



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