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, for the set +x
command itself, is not completely avoidable. You can suppress it with { set +x; } 2>/dev/null
, but in some shells there's still a trace for the redirection itself. You can avoid a trace for set +x
by not running it and instead letting the (sub)shell exit: if it's ok to run the traced command(s) in a subshell, you can use(set -x; command to trace; other command to trace); command that is not traced
.
set
is a shellbuiltin
command (at least in bash it is), so the documentation is found in bash's man page. Search the man page for/^ *SHELL BUILTIN COMMANDS
to read all aboutset
and its friends! – dg99 Aug 07 '14 at 19:25man
page forset
! It is part of the POSIX programmers guide... You should really get that series... please? – mikeserv Aug 07 '14 at 20:55help set
. – 200_success Aug 07 '14 at 22:28