Last active
June 3, 2025 16:04
-
-
Save bzerangue/4393408 to your computer and use it in GitHub Desktop.
Revisions
-
bzerangue revised this gist
Dec 28, 2012 . 1 changed file with 3 additions and 1 deletion.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 @@ -2,7 +2,9 @@ # @author: 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} -
bzerangue revised this gist
Dec 28, 2012 . 1 changed file with 4 additions and 0 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 @@ -1,4 +1,8 @@ #! /bin/sh # @author: Claus Witt # http://clauswitt.com/319.html # Adding Items to hosts file DEFAULT_IP=127.0.0.1 IP=${3:-$DEFAULT_IP} -
bzerangue created this gist
Dec 28, 2012 .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,25 @@ #! /bin/sh 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 ;; *) echo "Usage: " echo "hosts.sh [add|remove] [hostname] [ip]" echo echo "Ip defaults to 127.0.0.1" echo "Examples:" echo "hosts.sh add testing.com" echo "hosts.sh remove testing.com 192.168.1.1" exit 1 ;; esac exit 0