如何在unix shell中撤消"set -x"?

Bri*_*son 14 unix shell

在跟随互联网上的一些随机指示,尝试在shell上调试我的问题(我使用zsh),我跑了set -x.多亏了这一点,我想出了我的问题.然而,我现在处于一个尴尬的位置,不知道如何关闭这个调试 - 我真的甚至不了解我在一开始就做了什么,你看.

我也想到我可以做zsh一个新的shell.显而易见的unset -x是行不通的.我想知道正确的方法.谢谢!

更新:

发现这个 unix和linux堆栈的交换帖子讲的是什么-x.仍然不知道如何关闭它.

and*_*otn 27

您可以使用set +x它将其切换回来.输出help set描述了这个:

$ 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.
Run Code Online (Sandbox Code Playgroud)

注意"使用+而不是-使这些标志关闭"部分.