Skip to content

Instantly share code, notes, and snippets.

@piotrkubisa
Created September 10, 2015 17:08
Show Gist options
  • Save piotrkubisa/2a1230c3a4aa15ac6af5 to your computer and use it in GitHub Desktop.
Save piotrkubisa/2a1230c3a4aa15ac6af5 to your computer and use it in GitHub Desktop.
Add quickly record to /etc/hosts
#!/bin/bash
# http://matthewhutchinson.net/2011/1/10/configuring-subdomains-in-development-with-lvhme
SUBDOMAIN=$1
TLD=$2
if [ $# -lt 1 ]
then
echo "which subdomain?"
read SUBDOMAIN
if [ -n "$SUBDOMAIN" ]
then
SUBDOMAIN="$SUBDOMAIN."
fi
fi
if [ $# -lt 2 ]
then
echo "which tld?"
read TLD
fi
echo "127.0.0.1 $SUBDOMAIN$TLD" >> /etc/hosts
echo "OK, added 127.0.0.1 $SUBDOMAIN$TLD to /etc/hosts"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment