How to undo "set -x" in unix shell?

18,395

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.

Share:
18,395

Related videos on Youtube

Brian Peterson
Author by

Brian Peterson

My toolbox: Python, Django & Flask, HTML/CSS, JQuery, Backbone, PostgreSQL/MySQL, Nginx, Debian

Updated on June 28, 2022

Comments

  • Brian Peterson
    Brian Peterson almost 2 years

    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.