10.3.2. Length of a variable
Using the ${#VAR } syntax will calculate the number of characters in a variable. If VAR is "*" or "@" , this value is substituted with the number of positional parameters or number of elements in an array in general. This is demonstrated in the example below:
[bob in ~] echo $SHELL
/bin/bash
[bob in ~] echo ${#SHELL}
9
[bob in ~] ARRAY=(one two three)
[bob in ~] echo ${#ARRAY}
3
* License

