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
1.4m articles
1.4m replys
5 comments
57.0k users