This commit is contained in:
baol 2024-12-18 00:08:47 +08:00
parent 716422073f
commit 9dbb28d168

View File

@ -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."