Friday, February 11, 2011

How to find length of a string in Linux

Suppose you have following variables in your shell
str="foobar"
and you want to output the length of this string (length of this string is 6) then run the following command
echo ${#str}

No comments:

Post a Comment