我初学shell,想编一个脚本,作用是根据选择序号,同时改mac和ip(临时性地修改一下即可)。脚本如下:
#!/bin/bash echo echo "Type ID below to change your MAC now , 0 to exit ." echo echo "1 00:26:82:D8:37:0A" "2 C4:17:FE:E0:13:FD" echo "3 00:1C:BF:96:47:37" "4 0C:60:76:13:16:7E" echo read m sudo ifconfig wlan0 down #select in "0" "1" "2" "3" "4" #do case $m in 0) sudo ifconfig wlan0 up exit;; 1) sudo ifconfig wlan0 hw ether 00:26:82:D8:37:0A;; 2) sudo ifconfig wlan0 hw ether 00:1C:BF:96:47:37;; 3) sudo ifconfig wlan0 hw ether C4:17:FE:E0:13:FD;; 4) sudo ifconfig wlan0 hw ether 0C:60:76:13:16:7E;; esac sudo ifconfig wlan0 up sudo /etc/init.d/networking restart exit 貌似我编的不太对,每次运行以后,网就断开了。求修正,谢谢! 另外,不知道临时性更改ip怎么做?再次谢谢! -------------- 下一部分 -------------- 一个HTML附件被移除... URL: <https://lists.ubuntu.com/archives/ubuntu-zh/attachments/20110504/fba28c39/attachment.html> -- ubuntu-zh mailing list ubuntu-zh@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-zh