I have a small script below; however, I don't quite understand the for loop and if statement. First, let's take a look at script:listFieldNumbers () { for ii in ${!field_number[@]}; do if [ $ii -lt $(( ${#field_number[*]}-1 )) ]; then echo -n $(( ${field_number[$ii]} + 1 )),; else echo $(( ${field_number[$ii]} + 1)); fi; done; }I don't understand what do following statements mean:field_number[@]{#field_number[*]}
Bash - non-numeral arguments to [] operator(array)
bash;shell script;array
field_number is an array${!field_number[@]} gives you the list of indices of the array${#field_number[*]} is the number of elements in the array.I'd recommend you look for a bash tutorial about arrays. They are a bit tricky to work with.