#!/bin/bash
#write by zhangliang 2008-10-31
#修改后台配置文件的脚本
#判断IP地址是否合法
judge_ip()
{
if [[ "$1" =~ '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$' ]]
then
echo
else
echo -ne "\e[40;31;1m 请重新输入:\e[0m"
read ip
judge_ip "$ip"
fi
}
judge_echo ()
{
case $1 in
y|Y)
echo
;;
n|N)
judge_ip "$1"
echo -ne "\e[40;33;1m 确认输入无误[y/n]: \e[0m"
read yes
judge_echo "$yes"
;;
*)
echo
echo -ne "\e[40;31;1m 请重新输入: \e[0m"
read yes
judge_echo "$yes"
;;
esac
}
echo -e "\e[40;36;1m 请输入网管管理平台web服务器的ip地址 \e[0m"
read ip
judge_ip "$ip"
echo "你输入的ip地址是: $ip"
echo -ne "\e[40;33;1m 确认输入无误[y/n]: \e[0m"
read yes
judge_echo "$yes"
IP1=$ip
Device=`route |grep UG |grep default|awk '{print $8}'`
ipaddress=`ifconfig $Device|grep Mask|awk '{print $2}'|awk -F ":" '{print $2}'`
unset ip
阅读(972) | 评论(1) | 转发(0) |