Skip to the content.

Length of String in Variable

We can get the length of string stored in a variable by writing variable name in following syntax -

${#Variable_Name}

Example

$ VAR="String"
$ echo "Size of variable 'VAR' is = ${#VAR}"

Source: StackOverFlow

Reference(s)