diff --git a/Tools/AddHost.sh b/Tools/AddHost.sh new file mode 100644 index 0000000..100bedf --- /dev/null +++ b/Tools/AddHost.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +function AddHost { + IP=$(whiptail --inputbox --nocancel "What is the IP of the device to add?" 8 39 192.168.1.10 --title "Add Host" 3>&1 1>&2 2>&3) + HOST=$(whiptail --inputbox --nocancel "What is the name of the device to add?" 8 39 Office-PC --title "Add Host" 3>&1 1>&2 2>&3) + HOST=$(echo $HOST | tr -dc '[:alnum:]\n\r') + echo "$IP $HOST" >> /etc/hosts +if whiptail --title "Add Host" --yesno "Do you wish to add more hosts?" 8 78; then + AddHost +else + clear +fi +} + +AddHost \ No newline at end of file