shell script array length
- by Dipro Sen
I assume arguments to my shell scripts willbe ./x.sh subject N file1 file2 fileN
So I am splicing argv from 3 till end candidates=${@:3}
now I want to check whether length of candidates is same as given N I am trying with echo $((${#candidates[@]})) which is always returning 1.
I can do echo "$#-2" | bc but, I shouldn't I be able to get array size ?
I can use bc to do integer comparison. but I've to know the size of `candidates array which I am not getting properly.