diff --git a/scripts/install_pve.sh b/scripts/install_pve.sh index 46f192e..e761ddc 100644 --- a/scripts/install_pve.sh +++ b/scripts/install_pve.sh @@ -25,14 +25,14 @@ temp_file_apt_fix="/tmp/apt_fix.txt" remove_duplicate_lines() { chattr -i "$1" - # 去除重复行并跳过空行和注释行 if [ -f "$1" ]; then - awk '!/^( *#|$)/ { if (!x[$0]++) print }' "$1" > "$1.tmp" && mv -f "$1.tmp" "$1" + awk 'NF && !/^( *#|$)/ { if (!x[$0]++) print; next } { print }' "$1" > "$1.tmp" && mv -f "$1.tmp" "$1" fi rm -rf "$1.tmp" chattr +i "$1" } + install_package() { package_name=$1 if command -v $package_name > /dev/null 2>&1 ; then