Here’s a simple little script that displays the number of characters in a string.

#!/bin/bash
if [[ $# -eq 0 ]] ; then echo 'Missing arguments'; exit 0; fi
var=$1
size=${#var}
echo $size

Command:

./length.sh abcdefghijklmnopqrstuvwxyz

Output:

26