Add Tools/AddHost.sh

This commit is contained in:
b.waal 2023-09-25 01:47:28 +02:00
parent 25d958a5e7
commit 432a9d7f13

15
Tools/AddHost.sh Normal file
View File

@ -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