Skip to content

Instantly share code, notes, and snippets.

View tariquesani's full-sized avatar

Dr. Tarique Sani tariquesani

View GitHub Profile
@tariquesani
tariquesani / bash_aliases.sh
Created March 21, 2018 05:49 — forked from Fuxy22/bash_aliases.sh
Bash Script functions to Manage /etc/hosts file for adding/removing hostnames.
# remove specified host from /etc/hosts
function removehost() {
if [[ "$1" ]]
then
HOSTNAME=$1
if [ -n "$(grep $HOSTNAME /etc/hosts)" ]
then
echo "$HOSTNAME Found in your /etc/hosts, Removing now...";
sudo sed -i".bak" "/$HOSTNAME/d" /etc/hosts