1.
echo `ifconfig eth0 2>/dev/null | \
grep "^.*inet[[:space:]]\+" | \
sed "s/.*inet[[:space:]]\+\([0-9\.]*\).*/\1/"`
上面这条命令可以帮我获取到网卡的ip,求教想获取mac地址怎么写?
即
echo `ifconfig eth0 2>/dev/null | \
grep "^.*ether[[:space:]]\+" | \
sed "s/.*ether[[:space:]]\+??????"`
上面??????部分mac的正则表达式怎么写?
ifconfig eth0 |grep -i hwaddr|sed "s/.*HWaddr[[:space:]]\+\([a-z0-9\:]*\).*/\1/"