If you are on the bash shell and want to know what is the length of a string, then you can make use of the wc command.
Example:
bash-3.2$ echo -n "This is my string" | wc -c
17
We need the -n flag or else a new-line character will get added to the length.

Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!