shell-数组

1. 定义数组
    数组名=(元素1 元素2 元素3 ...)
2. 查看数组
    declare -a
3. 访问数组元素
    ${arr[0]}   访问某一个元素
    ${#arr[@]}  访问所有元素
    ${!arr[@]}  访问所有下标
    ${arr[@]:2}  访问下标2开始的所有元素
    ${arr[@]:2:2}  访问下标2开始的后两个元素
    
When nothing seems to help, I go look at a stonecutter hammering away at his rock, perhaps a hundred times without as much as a crack showing in it. Yet at the hundred and first blow it will split in two, and I know it was not that blow that did it, but all that had gone before. -- Jacob Riis
原文地址:https://www.cnblogs.com/xhwy-1234/p/12114777.html