You can use regular expressions to validate numbers, whether they are integers, negative integers or decimals, you could do something like this:
validate_number=^-?[0-9]+([.][0-9]+)?$;
echo "Please Enter your number ";
read number
if ![[ $number =~ $validate_number ]]; then
echo "number not valid"
fi
the regular expressions are:
[1.] ^ -? this expression verifies the beginning of the string and if it contains some character only one -
[2.] [0-9] verify that they are numbers from 0 to 9
[3.] the character + specifies the operator or
[4.] ([.] [0-9] +) $ confirms if the entered value was a decimal number and verifies the end of the string with $
The previous code receives a keyboard argument and verifies if the input was really a number, whether positive, negative or decimal