logging-wrapper.sh

来自「Shall高级编程」· Shell 代码 · 共 23 行

SH
23
字号
#!/bin/bash#  Generic shell wrapper that performs an operation#+ and logs it.# Must set the following two variables.OPERATION=#         Can be a complex chain of commands,#+        for example an awk script or a pipe . . .LOGFILE=#         Command-line arguments, if any, for the operation.OPTIONS="$@"# Log it.echo "`date` + `whoami` + $OPERATION "$@"" >> $LOGFILE# Now, do it.exec $OPERATION "$@"# It's necessary to do the logging before the operation.# Why?

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?