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