From 432a9d7f13f8893ff4fad865fab6d827e5406f22 Mon Sep 17 00:00:00 2001 From: "b.waal" Date: Mon, 25 Sep 2023 01:47:28 +0200 Subject: [PATCH] Add Tools/AddHost.sh --- Tools/AddHost.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Tools/AddHost.sh 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