Created
August 30, 2020 19:56
-
-
Save larien/80d3407972f46a08c0e8a11a0d1271a6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# !/bin/bash | |
echo "Insira dois números: " | |
read a | |
read b | |
echo "Escolha a operação:" | |
echo "1. +" | |
echo "2. -" | |
echo "3. *" | |
echo "4. /" | |
read ch | |
if [ $ch -eq "1" ] | |
then | |
res=`echo $a + $b | bc` | |
elif [ $ch -eq "2" ] | |
then | |
res=`echo $a - $b | bc` | |
elif [ $ch -eq "3" ] | |
then | |
res=`echo $a \* $b | bc` | |
elif [ $ch -eq "4" ] | |
then | |
res=`echo "scale=2; $a / $b" | bc` | |
else | |
echo "comando inválido" | |
fi | |
echo "Resultado : $res" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment