shell数组循环

[b][color=olive][size=large]测试shell数组,循环的例子:[/size][/color][/b]

arr=("a" "b" "c")

echo "所有的内容如下:"${arr[@]}


echo "数组的长度:"${#arr[*]}

for var in ${arr[@]}
do
echo "打印的内容:"$var
done


[b][color=olive][size=large]输出的内容如下:[/size][/color][/b]

[img]http://dl2.iteye.com/upload/attachment/0096/7909/16b5ba47-b3d0-344c-980b-7b85e8a963b6.jpg[/img]

你可能感兴趣的:(Linux)