Get the length of a variable's value with the following command:
length=${#var}
Consider this example:
$ var=12345678901234567890$
echo ${#var}
20
The length parameter is the number of characters in the string.
Linux Shell Scripting Cookbook - Third Edition
by Shantanu Tushar
Published by
Packt Publishing, 2017
Get the length of a variable's value with the following command:
length=${#var}
Consider this example:
$ var=12345678901234567890$
echo ${#var}
20
The length parameter is the number of characters in the string.