Phan Thị Thùy Dương
Member
How do I find the length of a string in Linux?
Answer
Any of the following syntaxes can be followed to count the length of string.
Answer
Any of the following syntaxes can be followed to count the length of string.
- ${#strvar} expr length $strvar. expr “${strvar}”:’. …
- $ string=”Hypertext Markup Language” $ len=`expr length “$string”` $ echo “The length of string is $len”
- #!/bin/bash. echo “Enter a string:” read strval. …
- #!/bin/bash. strval=$1.