Created
January 11, 2014 21:55
-
-
Save coderofsalvation/8377463 to your computer and use it in GitHub Desktop.
determines if variable is float
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # determines if variable is float | |
| # @param string input | |
| # usage: is_float "12.0" && echo "yes" | |
| is_float(){ | |
| echo "$1" | grep \\. | grep -Eq '^[-+]?[0-9]+\.?[0-9]*$' &>/dev/null && return 0 || return 1 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment