#!/bin/bash

IP=`echo $1|egrep -oc "^[^ ]([0-9]{1,3}\.){3}([0-9]{1,3})$"`

if [ ${IP} -eq 0 ];then

echo "请输入合规IP"

exit

else
echo "配置完成$1"

fi

if [ ! -f "/etc/systemd/network/20-eth0.network" ];then
   echo "file not found"
else
   sed -i "s#Gateway.*#Gateway=${1}#" /etc/systemd/network/20-eth0.network
fi


