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

时间:2014-08-07 00:36:51

标签: shell unix

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

我还想到我可以做zsh并获得一个新shell。显而易见的unset -x不起作用。我想知道正确的方法。谢谢!

更新

找到this unix& linux堆栈交换帖子,了解-x的内容。仍然不知道如何关闭它。

1 个答案:

答案 0 :(得分:23)

您可以使用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.

请注意,“使用+而不是-会导致这些标记被关闭”部分。