From 5deb1bbc6c321747b4db05568a9b7515c3a5b0ee Mon Sep 17 00:00:00 2001 From: XieHaoLiang <806854015@qq.com> Date: Wed, 24 Jul 2024 09:59:38 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=A0=E6=AD=A3=E8=87=AA=E5=8A=A8=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E5=BA=9F=E5=BC=83=E6=8E=A5=E5=8F=A3=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pre_build.sh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/pre_build.sh b/pre_build.sh index cb380742..c3d3b3af 100644 --- a/pre_build.sh +++ b/pre_build.sh @@ -75,28 +75,31 @@ done < <(egrep -o "'[^']*'" "$file_path") echo "* 解析 api 文件数据,开始对比" + + # 进度条初始化 total_urls=$(echo "$urls" | wc -l | tr -d ' ') current_url=0 -# 将所有API URL连接成一个长字符串 -all_urls=$(printf "%s" "${string_array[@]}") -# 移除单引号以便比较 -cleaned_all_urls=$(echo "$all_urls" | tr -d "'") # 检查每个废弃的API URL for url in $urls; do - if [[ "$cleaned_all_urls" == *"$url"* ]]; then - echo "错误: 存在废弃 api: $url" - exit 1 - fi + #删除${string_array[@]}中的单引号 + string_array=(${string_array[@]//\'/}) + for element in "${string_array[@]}"; do + if [[ "$element" == "$url" ]]; then + echo "错误: 存在废弃 api: $url" + exit 1 + fi + done # 更新进度条 let current_url++ let progress=(current_url*100/total_urls) printf "\r进度: [%-50s] %d%%" $(printf '%*s' $((progress/2)) | tr ' ' '#') $progress done + # 新的输出从新行开始 echo -e "\n* 没有发现废弃 API,开始编译"