Skip to content

Instantly share code, notes, and snippets.

@coderofsalvation
Created January 11, 2014 21:55
Show Gist options
  • Select an option

  • Save coderofsalvation/8377463 to your computer and use it in GitHub Desktop.

Select an option

Save coderofsalvation/8377463 to your computer and use it in GitHub Desktop.
determines if variable is float
# 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