方法1.
expr length "string"
# expr length "jsldjfoupsdfplsjdlf"
19

方法2.
# echo "jsldjfoupsdfplsjdlf"|awk '{print length()}'
19

方法3.
# myvar="jsldjfoupsdfplsjdlf"
# echo ${#myvar}
19