#!/bin/sh
clear
echo "At anytime you can type: \"info\" to get more info on the item."
echo " "
printf "IP Address?: "
read ip
if [ "$ip" == "info" ]; then
info=`cat test.txt`
echo "$info"
echo " "
printf "IP Address?: "
read ip
fi
ipchk=`ifconfig 2>&1 | grep inet | grep -v inet6 | awk '{print $2}' | grep "$ip"`
while [ "$ipchk" != "$ip" && "$ipchk" != "info" ]
do
echo "Invalid Ip"
echo " "
printf "IP Address?: "
read ip
ipchk=`ifconfig 2>&1 | grep inet | grep -v inet6 | awk '{print $2}' | grep "$ip"`
done
echo "IP: $ip"
## results ##
# get-test
At anytime you can type: "info" to get more info on the item.
IP Address?: info
[: info: unexpected operator
[: missing ]
IP: info