Tuesday, May 5, 2009

Is this an integer?


function isInteger ()
{
  echo "$@" | grep -q -v "[^-0-9]"
}

if isInteger 1975; then echo "Yes, that is an integer"; fi

Yes, that is an integer

No comments:

Post a Comment