mirror of
https://github.com/juewuy/ShellCrash.git
synced 2026-03-11 07:51:45 +00:00
~优化实现
This commit is contained in:
@@ -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"
|
||||
}
|
||||
Reference in New Issue
Block a user