一:数组
取最后一个元素:echo ${ARR1[${#ARR1[@]}-1]} echo ${ARR1[@]:(-1)} echo "${array[-1]}"(Bash 4.2)
To get both the index and the value:
for index in "${!array[@]}"
do
echo "$index ${array[index]}"
done
移除元素: unset,
shift: array=("${array[@]:1}") #removed the 1st element