Created
February 10, 2013 17:45
-
-
Save earthgecko/4750394 to your computer and use it in GitHub Desktop.
is_integer
This file contains 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
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