- Bash Script: Check if variable is integer or not

Below is a simple bash script to check if any given number is integer or not ...

#!/bin/bash
echo "Enter the value: ";
read num;
checkInteger(){
        if [ $1 -eq $1 2> /dev/null ]; then
                echo "$1 is a integer"
        else
                echo "$1 is not a integer"
        fi
}
checkInteger $num



source:http://linuxpoison.blogspot.com/2012/05/135781677510764.html