Skip to content

Instantly share code, notes, and snippets.

@poundbangbash
Created April 5, 2016 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save poundbangbash/f581bfcaf8e0c7a4f454ece6fcba931a to your computer and use it in GitHub Desktop.
Save poundbangbash/f581bfcaf8e0c7a4f454ece6fcba931a to your computer and use it in GitHub Desktop.
#!/bin/bash
#Delete all custom CUSTOMPHRASE additions every time this is run
awk '!/#CUSTOMPHRASE/' /etc/hosts > /tmp/hosts && cp -f /tmp/hosts /etc/hosts
sleep 1
#Add current CUSTOMPHRASE custom additions to /etc/hosts
echo "#CUSTOMPHRASE Location File Server Header" >> /etc/hosts
echo "192.168.0.1 myserver.example.com #CUSTOMPHRASE" >> /etc/hosts
echo "192.168.0.2 herserver.example.com #CUSTOMPHRASE" >> /etc/hosts
echo "#CUSTOMPHRASE Other Server Header" >> /etc/hosts
echo "10.0.0.3 hisserver.example.com #CUSTOMPHRASE" >> /etc/hosts
echo "10.0.0.4 ourserver.example.com #CUSTOMPHRASE" >> /etc/hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment