Bash set +x without it being printed

后端 未结 5 1308
轻奢々
轻奢々 2020-12-07 11:56

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

set -x
command
set +x

traces

+ command         


        
5条回答
  •  鱼传尺愫
    2020-12-07 12:33

    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
    

提交回复
热议问题