Saturday, April 16, 2011

how to find length of a variable in BASH?

lets define a variable first,
# TEST=1234567890
to find the length of variable TEST,
# echo ${#TEST}
its possible to assign the length to a new variable, say LENGTH
# echo $LENGTH
now try to find the length of the following variable,
# TEST="my length is"
Technorati Tags: ,

No comments:

Post a Comment