tolikpunkoff

check-integer-numbers-in-bash-variables-2

Aug 29th, 2016
196
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. #check integer positive and negative 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