Article Listing 1 Listing 2 Listing 3 Listing 4
Listing 5 Listing 6 Listing 7 Listing 8 Listing 9 jun2006.tar

Listing 5 is_integer

# This function returns true if $1 is an integer; otherwise, 
# returns false.  echo the argument to eliminate white space.
 
is_integer()
{
    case $(echo $1) in
        +([-+0-9])) return 0 ;;
        *) return 1 ;;
    esac
}
# End Listing 5: