You can use a substring to extract the first character of the first argument in a script:
if [ ${1:0:1} -lt 7 ]; then
echo "The first digit is smaller than 7"
fi
To do this for each character, you can use a loop:
for (( i = 0; i < ${#1}; ++i )); do
if [ ${1:$i:1} -lt 7 ]; then
echo "Character $i is smaller than 7"
fi
done
Notice that I changed -le(less than or equal to) to -lt(less) to make your message correct.
source
share