sed指令修改arm-Linux系統的開發板網絡配置文件 eth0-setting。

Linux指令--- sed:

sed指令修改arm-Linux系統的開發板網絡配置文件 eth0-setting。


不直接修改替換eth0-setting文件中的內容。先用sed指令修改要修改的IP地址,DNS等,利用 > 指令將修改後的內容寫到新的文件eth0-new中,再用cat  >  指令讀取文件內容並覆蓋掉eth0-setting中的內容。重新執行網絡配置函數ifconfig-eth0


sed -e '1c IP=192.168.0.230' -e '2c Mask=255.255.255.0' -e '3c Gateway=192.168.0.1' -e '4c DNS=218.85.152.99'  /etc/eth0-setting > /etc/eth0-new

cat /eth0-new > /eth0-setting
/etc/init.d/ifconfig-eth0
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章