shell读文件 数组遍历

#!/bin/bash
file=ip.txt
i=0
for line in `cat ip.txt`
do
array[$i]=$line
let i+=1
done

for (( i=0;i<${#array[@]};i++))#数组长度
do
echo ${array[i]}
done

posted @ 2022-06-22 18:45  MoonXu  阅读(179)  评论(0)    收藏  举报