巴什一套+ X未经打印它 [英] Bash set +x without it being printed

查看:156
本文介绍了巴什一套+ X未经打印它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道,如果我们可以说设置+ X 在没有它进行打印庆典:

Does anyone know if we can say set +x in bash without it being printed:

set -x
command
set +x

痕迹

+ command
+ set +x

但它应该只是打印

but it should just print

+ command

击是4.1.10版(4)。这是窃听我有一段时间了 - 输出堆满了没用设置+ X 线,使得跟踪工具,因为它可以不是有用

Bash is Version 4.1.10(4). This is bugging me for some time now - output is cluttered with useless set +x lines, making the trace facility not as useful as it could be.

推荐答案

我有同样的问题,我能找到不使用子shell的解决方案:

I had the same problem, and I was able to find a solution that doesn't use a subshell:

set -x
command
{ set +x; } 2>/dev/null

这篇关于巴什一套+ X未经打印它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆