Monday, December 5, 2011

String length

ubuntu1004@ubuntu1004:~$ str=abcdef
ubuntu1004@ubuntu1004:~$ echo ${#str}
6
ubuntu1004@ubuntu1004:~$ echo `expr length $str`
6
ubuntu1004@ubuntu1004:~$ echo `expr "$str" : '.*'`
6

No comments:

Post a Comment