Bash set +x without it being printed

后端 未结 5 1303
轻奢々
轻奢々 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:37

    You can use a subshell. Upon exiting the subshell, the setting to x will be lost:

    ( set -x ; command )
    

提交回复
热议问题