You can use ${#<string_var>} to get the length of a string in Linux bash shell –
1 2 3 4 5 6 7 8 9 |
## define a string variable mystring="cloudaffaire" ## print the string length echo ${#mystring} ## Returns 12 ## assign the string lenght to a variable strlenght=${#mystring} echo $strlenght ## Returns 12 |