How to find the array length in unix shell?
+2
A:
Assuming bash:
~> declare -a foo
~> foo[0]="foo"
~> foo[1]="bar"
~> foo[2]="baz"
~> echo ${#foo[*]}
3
So, ${#ARRAY[*]}
expands to the length of the array ARRAY
.
unwind
2009-12-11 07:26:33