Skip to content

Commit

Permalink
Script : Add host to local DNS
Browse files Browse the repository at this point in the history
Kanav Arora committed Jun 5, 2024
1 parent 131c28a commit b47ed41
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions addhost
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#! /bin/bash



echo "========================================================="
echo "$(figlet Find Me Here)"
echo "========================================================="

if [ "$1" == "" ];
then
echo "Script Usage:"
echo "_________________________________"
echo "| adddns -a ipaddress hostname |"
echo "| adddns -d ipaddress |"
echo "---------------------------------"
fi



if [ "$1" == "-a" ];
then
echo "Adding DNS Entry"
echo "$2 $3" >> /etc/hosts
echo "DNS Entry Added"
fi

if [ "$1" == "-d" ];
then
echo "Deleting DNS Entry"
sed -i "/$2/d" /etc/hosts
echo "DNS Entry Deleted"
fi

0 comments on commit b47ed41

Please sign in to comment.