This short how-to shows how to find out a string length in bash:
Copied from the very useful web site:
http://unstableme.blogspot.com/2008/03/find-string-length-bash.html

Suppose:
$ VAR="Bash Scripting"
Now to find the length of the above string, I have found 3 different ways:
$ echo "${#VAR}"
14

$ expr length "$VAR"
14

$ echo $VAR | awk '{print length}'
14