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

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

Command:

<pre lang="bash">
./length.sh abcdefghijklmnopqrstuvwxyz

Output:

<pre lang="bash">
26