#!/bin/bash if grep -xq "^##START" /etc/hosts; then echo "enabling..." sudo sed -i "/^##START/,/^##END/s/#\(.\)/\1/" /etc/hosts sudo mv /etc/opensnitchd/adblock/stevenblack /etc/opensnitchd/adblock/stevenblack.txt while true; do sleep 0.5s dig adservice.google.com &>/dev/null || break done notify-send "Enabled adblock!" else echo "disabling..." sudo sed -i "/^#START/,/^#END/s/./#&/" /etc/hosts sudo mv /etc/opensnitchd/adblock/stevenblack.txt /etc/opensnitchd/adblock/stevenblack while true; do sleep 0.5s dig adservice.google.com &>/dev/null && break done notify-send "Disabled adblock!" fi