Advertisement
obernardovieira

Compare 2 inputs (integer)

Mar 21st, 2015
482
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.36 KB | None | 0 0
  1. #! /bin/bash
  2.  
  3. args=("$@")
  4.  
  5. if test $((${args[0]})) -ne $((${args[1]}))
  6. then
  7.     if test $((${args[0]})) -gt $((${args[1]}))
  8.     then
  9.         echo "Hello, I'm compare, and ${args[0]} is greater than ${args[1]}"
  10.     else
  11.         echo "Hello, I'm compare, and ${args[0]} is smaller than ${args[1]}"
  12.     fi
  13. else
  14.     echo "Hello, I'm compare, and ${args[0]} is equal to ${args[1]}"
  15. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement