SHARE
TWEET

integer-number-check-in-bash-variables-1

tolikpunkoff Aug 29th, 2016 146 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. #check integer positive numbers in bash variables
  3.  
  4. if (echo "$1" | grep -E -q "^?[0-9]+$"); then
  5.     echo "Number"
  6. else
  7.     echo "Not Number"
  8. fi
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top