Skip to content

Instantly share code, notes, and snippets.

@earthgecko
Created February 10, 2013 17:45
Show Gist options
  • Save earthgecko/4750394 to your computer and use it in GitHub Desktop.
Save earthgecko/4750394 to your computer and use it in GitHub Desktop.
is_integer
function is_integer () {
# exit code 0 - the string is an integer
# exit code 1 - the string is not an integer
local string=$1
[[ $string == ${string//[^0-9]/} ]]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment