Introduction
You use ${#var} to find out how many characters are in a string. This helps when you want to check or use the length of text in your script.
Checking if a user input is empty or too long.
Counting characters in a filename before processing it.
Validating password length in a script.
Measuring the length of a string read from a file.
Controlling loops based on string length.