上面只修改了 log 函数,ta.sh 中的每一行日志开头就都输出了当前的时间, $@ 表示传入log 函数的所有参数。再次调整 t.sh 中 LOG_LEVEL 为 3 , 执行 ./ta.sh 命令,结果如下。