From 13fc116985d85aec49c26e9360eee3e8d3bab8a0 Mon Sep 17 00:00:00 2001 From: juewuy Date: Sat, 4 Apr 2026 19:50:42 +0800 Subject: [PATCH] =?UTF-8?q?~=E4=BF=AE=E5=A4=8D=E6=9C=AC=E5=9C=B0=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E5=86=85=E6=A0=B8=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/libs/i18n.sh | 4 ++-- scripts/menu.sh | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/scripts/libs/i18n.sh b/scripts/libs/i18n.sh index 1b0af090..01ec63eb 100644 --- a/scripts/libs/i18n.sh +++ b/scripts/libs/i18n.sh @@ -3,6 +3,6 @@ load_lang() { i18n=$(cat "$CRASHDIR"/configs/i18n.cfg 2>/dev/null) [ -z "$i18n" ] && i18n=chs - file="$CRASHDIR/lang/$i18n/$1.lang" - [ -s "$file" ] && . "$file" + i18n_file="$CRASHDIR/lang/$i18n/$1.lang" + [ -s "$i18n_file" ] && . "$i18n_file" } \ No newline at end of file diff --git a/scripts/menu.sh b/scripts/menu.sh index 5cdce9fc..4f85cb7c 100644 --- a/scripts/menu.sh +++ b/scripts/menu.sh @@ -144,20 +144,21 @@ ckstatus() { # 检查/tmp内核文件 for file in $(ls /tmp | grep -v [/$] | grep -v ' ' | grep -Ev ".*(zip|7z|tar)$" | grep -iE 'CrashCore|^clash$|^clash-linux.*|^mihomo.*|^sing.*box'); do - comp_box "$MENU_TMP_CORE_FOUND \033[36m/tmp/$file\033[0m" \ + local tmp_file="/tmp/$file" + comp_box "$MENU_TMP_CORE_FOUND \033[36m$tmp_file\033[0m" \ "$MENU_TMP_CORE_ASK" btm_box "1) 立即加载" \ "0) 暂不加载" read -r -p "$COMMON_INPUT> " res [ "$res" = 1 ] && { - zip_type=$(echo "$file" | grep -oE 'tar.gz$|upx$|gz$') + zip_type=$(echo "$tmp_file" | grep -oE 'tar.gz$|upx$|gz$') . "$CRASHDIR"/menus/9_upgrade.sh && setcoretype - . "$CRASHDIR"/libs/core_tools.sh && core_check "/tmp/$file" + . "$CRASHDIR"/libs/core_tools.sh && core_check "$tmp_file" if [ "$?" = 0 ] && [ -n "$crashcore" ]; then msg_alert "\033[32m$MENU_CORE_LOADED_OK\033[0m" switch_core else - rm -rf /tmp/"$file" + rm -rf "$tmp_file" msg_alert "\033[33m$MENU_CORE_LOADED_BAD\033[0m" \ "\033[33m$MENU_CORE_REMOVED\033[0m" fi @@ -166,17 +167,17 @@ ckstatus() { # 检查/tmp配置文件 for file in $(ls /tmp | grep -v [/$] | grep -v ' ' | grep -iE 'config.yaml$|config.yml$|config.json$'); do - tmp_file=/tmp/$file - comp_box "$MENU_TMP_CFG_FOUND\033[36m/tmp/$file\033[0m" \ + local tmp_file="/tmp/$file" + comp_box "$MENU_TMP_CFG_FOUND\033[36m$tmp_file\033[0m" \ "$MENU_TMP_CFG_ASK" btm_box "1) 立即加载" \ "0) 暂不加载" read -p "$COMMON_INPUT> " res [ "$res" = 1 ] && { - if [ -n "$(echo /tmp/$file | grep -iE '.json$')" ]; then - mv -f /tmp/$file "$CRASHDIR"/jsons/config.json + if [ -n "$(echo $tmp_file | grep -iE '.json$')" ]; then + mv -f "$tmp_file" "$CRASHDIR"/jsons/config.json else - mv -f /tmp/$file "$CRASHDIR"/yamls/config.yaml + mv -f "$tmp_file" "$CRASHDIR"/yamls/config.yaml fi msg_alert "\033[32m$MENU_CFG_LOADED_OK\033[0m " }