getIp.sh

来源:互联网 发布:xshell mac 代替 编辑:程序博客网 时间:2024/05/23 12:05

有时候安装虚拟机后,没有IPV4,利用此脚本,反复启动network,直到获得IP为止。

#!/bin/bashi=0failed="go"while [ "x${failed}"!="x" ];do    let i+=1    echo "Try to get ip $i"    failed=`service network restart|grep "eth0.*failed"`doneecho "Get ip successfully after tried $i"


0 0
原创粉丝点击