Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. #!/bin/bash
  2. clear
  3. echo "First number is" $1
  4. echo "Second number is" $2
  5.  
  6. var1=`echo $1`
  7. var2=`echo $2`
  8.  
  9. while [[ $num -ne 1 ]]
  10. do
  11. if [[ var1 -ge 0 ]] && [[ var2 -ge 0 ]];
  12. then
  13.  
  14. echo "Both numbers are positive"
  15. break
  16. else
  17. echo -n "You have entered negative number(s), please enter positive numbers: "
  18. read var1 var2
  19.  
  20. fi
  21. done
  22.  
  23. echo -n "Please choose one of the following letters to choose an option: "
  24. read option
  25. #echo "a) Display the sum of the two numbers."
  26. #echo "b) Display the product of the two numbers."
  27. #echo "c) State whether the two individual numbers are ODD or EVEN."
  28. #echo "d) Display the higher of the two numbers."
  29. #echo "e) What number did you like?"
  30. #echo "f) Quit/Exit."
  31.  
  32.  
  33. case $option in
  34. a) echo "The sum of the two intergers is: $(( var1 + var2 ))" ;;
  35. b) echo "The product of the two intergers is: $(( var1 * var2 ))" ;;
  36. c) echo "The number" ;;
  37. *) echo "INVALID OPTION" ;;
  38. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement