发布网友
共2个回答
热心网友
while :
do
echo please input a ip string
read ip
if echo $ip | grep "^[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}$"
then
echo $ip >> /etc/sysconfig/network/route
else
echo the string not a ip
fi
done
热心网友
grep -E "^((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])"
可以把match的条件改一下