20

In following some random directions on the internet, trying to debug an issue of mine at a shell (I use zsh), I ran set -x. Thanks to this I figured out my issue. However, I'm now in an awkward position of not knowing how to turn this debugging off -- I really don't even understand what I did in the first place, you see.

I also figured out that I could just do zsh and get a new shell. The obvious unset -x does not work. I would like to know the correct way. Thanks!

Update:

Found this unix&linux stack exchange post about what -x does. Still don't know how to turn it off.

Community
  • 1
  • 1
Brian Peterson
  • 2,800
  • 6
  • 29
  • 36

1 Answers1

39

You can use set +x to switch it back. The output of help set describes this:

$ help set
set: set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
    ...
    -v  Print shell input lines as they are read.
    -x  Print commands and their arguments as they are executed.
    ...

Using + rather than - causes these flags to be turned off.  The
flags can also be used upon invocation of the shell.  The current
set of flags may be found in $-.  The remaining n ARGs are positional
parameters and are assigned, in order, to $1, $2, .. $n.  If no
ARGs are given, all shell variables are printed.

Note the “Using + rather than - causes these flags to be turned off” part.

andrewdotn
  • 32,721
  • 10
  • 101
  • 130