How can I count the number of characters in a Bash variable

bash, linux

Solution

Using the `${#VAR}` syntax will calculate the number of characters in a variable.

https://www.gnu.org/software/bash/manual/bashref.html#Shell-Parameter-Expansion

Problem

How can I count all characters in a bash variable? For instance, if I had ``` "stackoverflow" ``` the result should be ``` "13" ```

Original source

Related problems