diff --git a/shell/otask.sh b/shell/otask.sh index af8dbc5b..e113f91a 100755 --- a/shell/otask.sh +++ b/shell/otask.sh @@ -269,6 +269,7 @@ check_file "${task_shell_params[@]}" if [[ $isJsOrPythonFile == 'false' ]]; then run_task_before "${task_shell_params[@]}" fi +set_u_on="false" if set -o | grep -q 'nounset.*on'; then set_u_on="true" set +u diff --git a/shell/share.sh b/shell/share.sh index a6879aaf..989c4431 100755 --- a/shell/share.sh +++ b/shell/share.sh @@ -451,9 +451,9 @@ handle_task_start() { run_task_before() { . $file_task_before "$@" - if [[ $task_before ]]; then + if [[ ${task_before:=} ]]; then echo -e "执行前置命令\n" - eval "$task_before" "$@" + eval "${task_before%;}" "$@" echo -e "\n执行前置命令结束\n" fi } @@ -463,7 +463,7 @@ run_task_after() { if [[ ${task_after:=} ]]; then echo -e "\n执行后置命令\n" - eval "$task_after" "$@" + eval "${task_after%;}" "$@" echo -e "\n执行后置命令结束" fi }