diff --git a/scripts/local_test.sh b/scripts/local_test.sh index d6c693e..0f0e3e3 100755 --- a/scripts/local_test.sh +++ b/scripts/local_test.sh @@ -10,6 +10,18 @@ # 版本号 = 最新 client-v* tag 的 patch+1 加 -dev 后缀(如 v1.1.4-dev), # App 内显示走 APP_VERSION dart-define(update_provider.currentAppVersion), # 与 CI 同一读取链路——本地构建不再显示 pubspec 旧版本(2026-07-04 修复)。 +# +# 本脚本用到 bash 专属特性(数组、进程替换 `>(...)`)。若被 `sh` 调起(macOS 的 +# /bin/sh 实为 bash --posix:会设 BASH_VERSION 但禁用进程替换,导致下方 xcodebuild +# 那行报 `syntax error near unexpected token '>'`),或被 dash 等非 bash 调起,则在 +# 解析到那行之前先重执行到普通模式 bash。此判断须是第一条可执行语句。 +_posix=no +case ":${SHELLOPTS:-}:" in *:posix:*) _posix=yes ;; esac +if [ -z "${BASH_VERSION:-}" ] || [ "$_posix" = yes ]; then + exec bash "$0" "$@" +fi +unset _posix + set -euo pipefail export PATH="/opt/homebrew/bin:$PATH"