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

 手机用户2502940425 发布于 2022-12-29 17:06

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

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

更新:

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

1 个回答
  • 您可以使用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.
    

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

    2022-12-29 17:10 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有