修改 shell 参数处理逻辑

This commit is contained in:
whyour 2023-02-02 12:14:35 +08:00
parent e70cd6579f
commit 34f690c53d

View File

@ -58,7 +58,7 @@ format_params() {
if type timeout &>/dev/null; then if type timeout &>/dev/null; then
timeoutCmd="timeout --foreground -s 14 -k 10s $command_timeout_time " timeoutCmd="timeout --foreground -s 14 -k 10s $command_timeout_time "
fi fi
params=$(echo "$@" | sed -E 's/([^ ])&([^ ])/\1\\\&\2/g') # params=$(echo "$@" | sed -E 's/([^ ])&([^ ])/\1\\\&\2/g')
} }
while getopts ":lm:" opt; do while getopts ":lm:" opt; do
@ -81,7 +81,7 @@ format_params "$@"
define_program "$@" define_program "$@"
handle_log_path "$@" handle_log_path "$@"
eval . $dir_shell/otask.sh "$params" "$cmd" eval . $dir_shell/otask.sh "$cmd"
[[ -f "$dir_log/$log_path" ]] && cat "$dir_log/$log_path" [[ -f "$dir_log/$log_path" ]] && cat "$dir_log/$log_path"
exit 0 exit 0