set -x
我在腳本中使用它來輸出執行時的行。
我想在那裡添加一些註釋,所以我使用該:
命令,但它什麼都不做
: :::: comment here
看起來不錯,但是如果其他行也有前置,而不是每行都有:
前置,看起來會更好。+
如何更改加號?
答案1
您可以設定PS4
shell 變數。從man bash
:
PS4 The value of this parameter is expanded as with PS1 and the value is printed before each command bash displays during an execution trace. The first character of PS4 is replicated mul‐ tiple times, as necessary, to indicate multiple levels of indi‐ rection. The default is ``+ ''.