#bash has no fractional numbers; bc -l and awk have no log10,
#so it is the natural logarithm divided by l(10)
number=1000
result=$(bc -l <<< "l($number) / l(10)")
#result is 3.00000000000000000000
printf -v resultShort '%g' "$result"
#resultShort is 3
fromAwk=$(awk -v x="$number" 'BEGIN { print log(x) / log(10) }')
#fromAwk is 3
#the whole part of log10 of a positive whole number
#is its count of digits minus one
digits=$((${#number} - 1))
#digits is 3
echo "result is $result"
echo "resultShort is $resultShort"
echo "fromAwk is $fromAwk"
echo "digits is $digits"