#!/bin/bash cd /etc/network #清除4-9行 sed -i '4,9d' interfaces #在第3行添加网卡名称 sed -i "3a auto ${1}" interfaces #在第4行添加 sed -i "4a iface ${1} inet static" interfaces #在第5行添加IP sed -i "5a address ${2}" interfaces #在第6行添加子网掩码 sed -i "6a netmask ${3}" interfaces #在第7行添加网关 sed -i "7a gateway ${4}" interfaces #在第8行添加DNS if test -z "${5}" then sed -i "8a dns-nameservers 0.0.0.0" interfaces else sed -i "8a dns-nameservers ${5}" interfaces fi echo "chang is succes"
Ubuntu脚本修改IP信息
免责声明:文章转载自《Ubuntu脚本修改IP信息》仅用于学习参考。如对内容有疑问,请及时联系本站处理。
上篇Linux 下svn恢复到某一版本VIM C语言函数名高亮下篇
宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=