Created
October 31, 2014 13:47
-
-
Save kossoff/15253757d471429081b7 to your computer and use it in GitHub Desktop.
Script for add & remove fake domains in Dnsmasq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
HOSTS="$HOME/Work/dnsmasq.hosts" | |
if [ $# == 2 ] || [ $# == 3 ]; then | |
case $# in | |
2 ) | |
echo Remove $2 from hosts | |
sed '/$2/d' $HOSTS | |
;; | |
3 ) | |
echo Add URL $3 with IP $2 to hosts | |
echo $2 $3 >> $HOSTS | |
;; | |
esac | |
sudo launchctl stop homebrew.mxcl.dnsmasq | |
sudo launchctl start homebrew.mxcl.dnsmasq | |
else | |
echo "Usage: $0 add IP DOMAIN or $0 remove DOMAIN" | |
exit | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment