我正在尝试制作一个模块化脚本。我有几个从单个脚本调用的脚本/命令。
我想为每个单独命令的输出添加前缀。
例子:
我的文件都是commands.sh/command1.sh/command2.sh
command1.sh输出
file exists
file moved
command2.sh输出
file copied
file emptied
allcommands.sh运行脚本command1.sh和command2.sh
我想为这两个脚本的每个输出添加前缀,如下所示:
[command1] file exists
[command1] file moved
[command2] file copied
[command2] file emptied