#!/bin/sh
#定义方法一 数组定义为空格分割
arrayWen=(a b c d e f)
#定义方法二
arrayXue[0]="m"
arrayXue[1]="n"
arrayXue[2]="o"
arrayXue[3]="p"
arrayXue[4]="q"
arrayXue[5]="r"
#打印数组长度
echo ${#arrayWen[@]}
#for 循环遍历
for var in ${arrayWen[@]};
do
echo $var
done
#while循环遍历
i=0
while [[ i -lt ${#arrayXue[@]} ]]; do
echo ${arrayXue[i]}
let i++
done