⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getip.sh

📁 shell 简单例程,含数学计算IP获取awk例程字数统计示例
💻 SH
字号:
#!/bin/bash# getip.sh -- get an usable ipaddress automatically# author: falcon <zhangjinw@gmail.com># update: Tue Oct 30 23:46:17 CST 2007net="192.168.1"default_gateway="192.168.1.239"over_time=2# check the current ipaddressping -c 1 $default_gateway -W $over_time[ $? -eq 0 ] && echo "the current ipaddress is okey\!" && exit -1;while :; do	# clear the current configuration        ifconfig eth0 down        # configure the ipaddress of the eth0        ifconfig eth0 \                $net.$(($RANDOM /130 +2)) \                up         # configure the default gateway        route add default gw $default_gateway        # check the new configuration        ping -c 1 $default_gw -W $over_time        # if work, finish        [ $? -eq 0 ] && breakdone

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -