diff --git a/n0.hosts.sh b/n0.hosts.sh index 2df1220..d39d0f9 100755 --- a/n0.hosts.sh +++ b/n0.hosts.sh @@ -65,7 +65,7 @@ EOL ) # 检查 /etc/hosts 中是否已经存在这些条目 -if ! grep -Fxq "$HOSTS_CONTENT" /etc/hosts; then +if ! grep -Fxf <(echo "$HOSTS_CONTENT") /etc/hosts > /dev/null; then echo "Adding entries to /etc/hosts..." echo "$HOSTS_CONTENT" | sudo tee -a /etc/hosts > /dev/null echo "Entries added successfully."