shell 获取数组中的所有元素

code

macname@localhost Desktop % cat test.sh 
my_array[0]=A
my_array[1]=B
my_array[2]=C
my_array[3]=D

echo "数组的元素为: ${my_array[*]}"
echo "数组的元素为: ${my_array[@]}"
macname@localhost Desktop % 
macname@localhost Desktop % ./test.sh          
数组的元素为: A B C D
数组的元素为: A B C D

 

 

 

 

 

 

 

 

posted @ 2020-11-25 21:11  anobscureretreat  阅读(2440)  评论(0编辑  收藏  举报