遍历数组元素
#!/bin/bash # 遍历数组元素 IP=(192.168.1.1 192.168.1.2 192.168.1.3) for ((i = 0; i < ${#IP[*]}; i++)); do echo ${IP[$i]} done for IP in ${IP[*]}; do echo $IP done