使用Shell循环打印数组
[[email protected] array]# cat a.sh #!/bin/bash array=( freddy freddie tang sheng wei ) for ((i=0;i<${#array[@]};i++));do echo "This is num $i,then content is ${array[$i]}" #$i是下标 done echo "-----------------" echo "array len:${#array[@]}"
时间: 2024-10-16 16:39:16