「teamspeak.com」のような IP/ドメインが /etc/hosts に存在するかどうかを確認する .sh スクリプトを作成しようとしています。存在しない場合は、ホスト ファイルに何かを追加します。
今、私はこれを試しています:
if ! grep -q "teamspeak.com == teamspeak.com" /etc/hosts; then
echo "Exists"
else
echo "Add to etc host ting here" >> /etc/hosts;
fi