Bash-it / bash-it

A community Bash framework.
MIT License
14.3k stars 2.29k forks source link

Calc #2251

Closed xnpatreyk closed 4 days ago

xnpatreyk commented 7 months ago

!/bin/bash

echo "Podaj pierwsza liczba:" 
read a 
echo "Podaj druga liczba:" 
read b 
echo "Podaj operacje (jedna z): +, - , / lub X" 
read opr 

if [ $opr = "+" ] 
then 
    op=`expr $a + $b`
    echo "$op"
elif [ $opr = "-" ] 
then 
    op=`expr $a - $b`
    echo "$op"
elif [ $opr = "/" ] 
then 
    op=`expr $a / $b`
    echo "$op"
elif [ $opr = "X" ] 
then 
    op=`expr $a \* $b`
    echo "$op"
fi