wlan0dhcp 294 B

12345678910111213141516
  1. #!/bin/bash
  2. var0=`ps aux|awk '/dhclient wlan0/'|awk '$11!="awk"{print $2}'`
  3. kill $var0
  4. cp ifcfg-wlan0 /etc/sysconfig/network-scripts/
  5. dhclient wlan0
  6. var1=`ifconfig wlan0 |awk '/inet/{print $2}'|awk -F: '{print $2}'`
  7. rm -f /etc/sysconfig/network-scripts/ifcfg-wlan0
  8. echo "get ip: $var1"