Skip to content

Instantly share code, notes, and snippets.

@davidsmalley
Created January 21, 2010 12:25
Show Gist options
  • Save davidsmalley/282759 to your computer and use it in GitHub Desktop.
Save davidsmalley/282759 to your computer and use it in GitHub Desktop.
#!/bin/bash
LASTLINE=`tail -n 1 /etc/hosts`
HOST=`tail -n 1 /etc/hosts | awk '{ print $2 }'`
echo "127.0.0.1 $HOST.domain.ext $HOST localhost.localdomain localhost" > /etc/hosts
echo $LASTLINE >> /etc/hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment