bash count chars code example
Example: bash count character in variable
$ mystring="one two three four five"
$ echo "string length: ${#mystring}"
string length: 23
$ mystring="one two three four five"
$ echo "string length: ${#mystring}"
string length: 23