Created
November 7, 2013 01:59
-
-
Save smoitra87/7347687 to your computer and use it in GitHub Desktop.
Toggle gmail in /etc/hosts
This file contains hidden or 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 | |
if [ -n "$(grep gmail /etc/hosts)" ] | |
then | |
echo "Gmail found : $(grep gmail /etc/hosts)" | |
echo "Removing gmail" | |
sed '/gmail/d' /etc/hosts > /tmp/gmailtoggle | |
sudo cp /tmp/gmailtoggle /etc/hosts | |
else | |
echo "Gmail not found, Adding gmail" | |
sudo echo -e "127.0.0.1\twww.gmail.com" >> /etc/hosts | |
fi | |
# Restarting network | |
sudo /etc/init.d/networking restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment