From 4332baec6fdbc8541e92bf9fc311cb89bc20e8bf Mon Sep 17 00:00:00 2001 From: spiritlhl <103393591+spiritLHLS@users.noreply.github.com> Date: Fri, 23 Jun 2023 14:02:51 +0000 Subject: [PATCH] update --- scripts/install_pve.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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