Array Length
suggest change${#array[@]}
gives the length of the array ${array[@]}
:
array=('first element' 'second element' 'third element')
echo "${#array[@]}" # gives out a length of 3
This works also with Strings in single elements:
echo "${#array[0]}" # gives out the lenght of the string at element 0: 13
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents