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 ``+ ''.