diff --git a/detection.sh b/detection.sh index 115cd02..feb9949 100644 --- a/detection.sh +++ b/detection.sh @@ -1,7 +1,8 @@ #!/bin/sh - -# 获取当前脚本所在目录的绝对路径 -SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +# 使用 readlink -f 获取脚本的真实路径 +SCRIPT=$(readlink -f "$0") +SCRIPT_DIR=$(dirname "$SCRIPT") echo "脚本当前目录:$SCRIPT_DIR" -mono "$SCRIPT_DIR"/Release/BenzObstacleDetect.exe \ No newline at end of file +cd "$SCRIPT_DIR/Release" || { echo "进入 Release 文件夹失败"; exit 1; } +mono BenzObstacleDetect.exe \ No newline at end of file