반응형
echo "Calulator"
echo "***********************"
echo "1. plus"
echo "2. minus"
echo "3. multiplication"
echo "4. division"
echo "***********************"
read Calulator
if [ $Calulator == 1 ]
then
echo "You typed Number -> 1. plus"
echo "Typed number1"
read number1
echo "Typed number2"
read number2
echo "-------result---------"
sum=$(($number1+$number2))
echo $sum
elif [ $Calulator == 2 ]
then
echo "You typed Number -> 2. minus"
echo "Typed number1"
read number1
echo "Typed number2"
read number2
echo "-------result---------"
mns=$(($number1-$number2))
echo $mns
elif [ $Calulator == 3 ]
then
echo "You typed Number -> 3. multiplication"
echo "Typed number1"
read number1
echo "Typed number2"
read number2
echo "-------result---------"
multi=$(($number1*$number2))
echo $multi
elif [ $Calulator == 4 ]
then
echo "You typed Number -> 4. division"
echo "Typed number1"
read number1
echo "Typed number2"
read number2
echo "-------result---------"
div=$(($number1/$number2))
echo $div
fi
반응형
'Command & Development > Shell Script' 카테고리의 다른 글
[Shell Script] Linux 설치 후 초기 설정 (0) | 2023.01.31 |
---|---|
[Shell Script] Ubuntu Shell Script : unexpected operator (0) | 2022.11.16 |
[Shell Script] Progress Bar (0) | 2022.09.22 |
[Shell Script] 사용자 입력받기 (0) | 2022.09.20 |
[Shell Script] sshpass 접속 검증 (0) | 2022.09.06 |