SHARE
TWEET

Bash Calc

Thewest123 Feb 14th, 2020 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. while true; do
  2.   echo "------[Kalkulačka]------"
  3.  
  4.   echo -n "Zadej 1. číslo: "
  5.   read -n 1 cislo1
  6.   echo ""
  7.   echo -n "Zadej 2. číslo: "
  8.   read -n 1 cislo2
  9.   echo ""
  10.  
  11.   echo "Vyber operaci: "
  12.   echo " 1) Sčítání"
  13.   echo " 2) Odečítání"
  14.   echo " 3) Násobení"
  15.   echo " 4) Dělení"
  16.   echo -n "Volba: "
  17.   read -n 1 operace
  18.   echo ""
  19.  
  20.   case $operace in
  21.     1) echo "$cislo1 + $cislo2 = $(($cislo1+$cislo2))" ;;
  22.     2) echo "$cislo1 - $cislo2 = $(($cislo1-$cislo2))" ;;
  23.     3) echo "$cislo1 * $cislo2 = $(($cislo1*$cislo2))" ;;
  24.     4) echo "$cislo1 / $cislo2 = $(($cislo1/$cislo2))" ;;
  25.     *) echo "Špatná volba, blbče!"
  26.   esac
  27. done
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