How to undo `set -x`?

Use set +x. More information:

$ type set
set is a special shell builtin

Since set is a shell builtin, it is documented in the documentation of your shell.

Beware that some systems have man pages for shell builtins, but these man pages are only correct if you're using the default shell. On Linux, you may have man pages that present POSIX commands, which will turn up for shell builtins because there's no man page of a standalone utility to shadow them; these man pages are correct for all Bourne-style shells (dash, bash, *ksh, and even zsh) but typically incomplete.

See Reading and searching long man pages for tips on searching for a builtin in a long shell man page.

In this case, the answer is the same for all Bourne-style shells. If set -LETTER turns on an option, set +LETTER turns it off. Thus, set +x turns off traces. The last trace that reads set +x is unavoidable (except by letting the shell exit — sometimes you can use a subshell (set -x; command to trace; other command to trace); command that is not traced).


You can stop debugging mode by set +x. See example page


You have enabled debug mode, you need to turn it off.

Extract form help set:

Using + rather than - causes these flags to be turned off.

So type set +x

Tags:

Shell