shell 数组

#!/bin/bash

 

arr=(1 2 3 4 5 6)

 

echo "print the elemetn as ${arr[idx]}"

for((i=0; i<6; i++))

do

    echo ${arr[$i]}

done

 

echo "print the element as a list ${arr[*]}"

echo ${arr[*]}

 

 

echo "print the element as a list ${arr[@]}"

echo ${arr[@]}

 

echo "print the len of arr: ${#arr[*]}"

echo ${#arr[*]}

原文地址:https://www.cnblogs.com/li-daphne/p/6912577.html