Last active
August 20, 2018 10:45
-
-
Save stoyanovgeorge/b7b5a33fe9c2c61edc5b3842bb397096 to your computer and use it in GitHub Desktop.
Check if $var is integer or not
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
#!/bin/bash | |
if [[ "$var" =~ ^-?[0-9]+$ ]];then | |
echo "integer" | |
else | |
echo "not integer" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment