shell脚本之字符串数组

linux

 

#!/bin/bash
arr=(apple pear banana "orange")
echo "first string :${arr[0]}"
echo "second string :${arr[1]}"
echo "third string :${arr[2]}"
echo "fourth string :${arr[3]}"
echo -e "\n"
echo "show all array node :${arr[*]}"
echo "show all array node :${arr[@]}"
echo "show array length :${#arr[*]}"
echo "show array length :${#arr[@]}"

输出结果:
first string :apple
second string :pear
third string :banana
fourth string :orange


show all array node :apple pear banana orange
show all array node :apple pear banana orange
show array length :4
show array length :4
如果发现下载不了或者地址失效,请联系客服QQ: 2323178881
找资料 » shell脚本之字符串数组

提供最优质的资源集合

立即查看 了解详情