-
-
Save crmaxx/891d29382f2a7794c5ed637e2bb1ad7f to your computer and use it in GitHub Desktop.
Revisions
-
jarlef revised this gist
Jul 17, 2015 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -13,8 +13,7 @@ case "$1" in echo "$IP $2" >> /etc/hosts ;; remove) sed -i "/\s$2/d" /etc/hosts ;; *) -
jarlef renamed this gist
Jul 17, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
jarlef created this gist
Jul 17, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ #! /bin/sh # @author: Jarle Friestad # Based on script by Claus Witt (http://clauswitt.com/319.html) # Adding or Removing Items to hosts file # Use -h flag for help DEFAULT_IP=127.0.0.1 IP=${3:-$DEFAULT_IP} case "$1" in add) echo "$IP $2" >> /etc/hosts ;; remove) #sed -ie "\|^$IP $2\$|d" /etc/hosts sed -i "/\s$2/d" /etc/hosts ;; *) echo "Usage: update-hosts COMMAND [args..]" echo echo "Utility for adding or removing entries in hosts file" echo echo "Commands:" echo " add update-hosts add [hostname] [ip]" echo " remove update-hosts remove [hostname]" echo echo "Ip defaults to 127.0.0.1" echo echo "Examples:" echo " update-hosts add testing.com 127.0.0.2" echo " update-hosts remove testing.com" exit 1 ;; esac exit 0