- 
      
- 
        Save ketanshah79/be7f45e7924e016d1007ca377f0d26eb to your computer and use it in GitHub Desktop. 
Revisions
- 
        Amos Wenger revised this gist Nov 15, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewingThis 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 @@ -7,7 +7,7 @@ remusage="Usage: `basename $0` -remove host" case "$1" in -add) if [ $# -eq 3 ]; then if [[ -n $(grep "^$3.*[^A-Za-z0-9\.]$2$" ${path}) ]]; then echo "Duplicate address/host combination, ${path} unchanged." else printf "$3\t$2\n" >> ${path} 
- 
        Amos Wenger revised this gist Nov 15, 2011 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewingThis 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 @@ -7,7 +7,11 @@ remusage="Usage: `basename $0` -remove host" case "$1" in -add) if [ $# -eq 3 ]; then if [[ -n $(grep "^$3.*[^A-Za-z0-9\.]$2$" hosts) ]]; then echo "Duplicate address/host combination, ${path} unchanged." else printf "$3\t$2\n" >> ${path} fi else echo $addusage; fi 
- 
        Amos Wenger revised this gist Nov 15, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewingThis 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,7 +1,7 @@ #!/bin/bash # Idea and interface taken from https://github.com/macmade/host-manager path="/etc/hosts" addusage="Usage: `basename $0` -add host address" remusage="Usage: `basename $0` -remove host" case "$1" in 
- 
        Amos Wenger created this gist Nov 15, 2011 .There are no files selected for viewingThis 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/bash # Idea and interface taken from https://github.com/macmade/host-manager path="hosts" addusage="Usage: `basename $0` -add host address" remusage="Usage: `basename $0` -remove host" case "$1" in -add) if [ $# -eq 3 ]; then printf "$3\t$2\n" >> ${path} else echo $addusage; fi ;; -remove) if [ $# -eq 2 ]; then sed -i '' -e "s/^[^#].*[^A-Za-z0-9\.]$2$//g" -e "/^$/ d" ${path} else echo $remusage; fi ;; *) echo $addusage; echo $remusage; esac 
 Amos Wenger
              revised
            
            this gist
            
              Amos Wenger
              revised
            
            this gist