Get the length of a string under UNIX/Linux
there many ways to do so.
str="hello world"
len=`expr length ${str}`
len=${#str}
len=`echo ${str} | awk "{ print length }"`
len=`echo -n ${str} | wc -c`
len=`echo -n ${str} | wc -c`
posted on 2012-04-01 15:14 gembin 閱讀(694) 評論(0) 編輯 收藏 所屬分類: Linux