Skip to content

Instantly share code, notes, and snippets.

@jamesrwhite
Created January 19, 2013 16:34
Show Gist options
  • Save jamesrwhite/4573530 to your computer and use it in GitHub Desktop.
Save jamesrwhite/4573530 to your computer and use it in GitHub Desktop.
osx addhost
function addhost {
colour1="\e[34m" # Blue
colour2="\e[31m" # Red
sudo sh -c "echo '$2\t$1' >> /etc/hosts" # Append to the hosts file
dscacheutil -flushcache # Flush DNS
echo "\e[0mPointed $colour1$1 \e[0mto $colour2$2\e[0m"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment