I've written a simple script that checks if a given number is float. But it isn't working quite opposite. Here's the code:
#! /bin/bash
main () {
if [[ "$1" == ^[0-9]+\.?[0-9]+ ]]
then
echo "Floating number"
else
echo "Not a floating number"
fi
}
main "$@"
When I'm giving a floating-point number, it's executing else part. Here's the output: