How do you get the length of a string stored in a variable and assign that to another variable?
myvar="some string" echo ${#myvar} # 11
How do you set another variable to the output 11?
11
To get the length of a string stored in a variable, say:
myvar="some string" size=${#myvar}
To confirm it was properly saved, echo it:
echo
$ echo "$size" 11
2.1m questions
2.1m answers
60 comments
57.0k users