写一个shell脚本自动生成指定网段的全部IP地址输出到 test_iptxt 文件中网段在运行脚本的时候以参数的形式输入。
#!/bin/bash
Usage: ./generate_ips.sh 192.168.0
if [ -z "$1" ]; then echo "Please provide IP network address: e.g. 192.168.0" exit 1 fi
network=$1 for i in {1..254} do ip_address="$network.$i" echo $ip_address >> test_ip.txt done
echo "IP addresses generated and saved to test_ip.txt file."
原文地址: https://www.cveoy.top/t/topic/e5pJ 著作权归作者所有。请勿转载和采集!