With egrep:
Code:
printf "%s\n" "$decimal"|egrep '^[0-9]+(\.[0-9][0-9])?$' >/dev/null && echo OK||echo KO
Or (with not too old versions):
Code:
printf "%s\n" "$decimal"|egrep -q '^[0-9]+(\.[0-9]{2})?$' && echo OK||echo KO
With bash3(and ksh93?):
Code:
[[ "$decimal" =~ ^[0-9]+(\.[0-9]{2})?$ ]]&&echo OK||echo KO
Of course, you should modify it a bit, if you want
.00 and 00. to be considered OK.