From 215fc29c3530b88f7a33e4bcd17a42ac15cc6801 Mon Sep 17 00:00:00 2001 From: juewuy Date: Mon, 26 Jan 2026 19:08:06 +0800 Subject: [PATCH] =?UTF-8?q?~=E4=BC=98=E5=8C=96=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/libs/set_config.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scripts/libs/set_config.sh b/scripts/libs/set_config.sh index c0e0d82f..c1cf3e7d 100644 --- a/scripts/libs/set_config.sh +++ b/scripts/libs/set_config.sh @@ -1,9 +1,6 @@ #参数1代表变量名,参数2代表变量值,参数3即文件路径 setconfig() { [ -z "$3" ] && configpath="$CRASHDIR"/configs/ShellCrash.cfg || configpath="${3}" - if grep -q "^${1}=" "$configpath"; then - sed -i "s#^${1}=.*#${1}=${2}#g" "$configpath" - else - printf '%s=%s\n' "$1" "$2" >>"$configpath" - fi + sed -i "/^${1}=.*/d" "$configpath" + printf '%s=%s\n' "$1" "$2" >>"$configpath" } \ No newline at end of file