Created
September 10, 2015 17:08
-
-
Save piotrkubisa/2a1230c3a4aa15ac6af5 to your computer and use it in GitHub Desktop.
Add quickly record to /etc/hosts
This file contains 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/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