#! /bin/bash line="127.0.0.1 www.facebook.com" if grep -q "www.facebook.com" /etc/hosts; then zenity --password | sudo -S bash -c "sed -i '/www.facebook.com/d' /etc/hosts" else zenity --password | sudo -S bash -c "echo ${line} >> /etc/hosts" fi