Advertisement
tolikpunkoff

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

Aug 29th, 2016
603
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.17 KB | None | 0 0
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement