aaaa@ubuntu:~$ ./test.sh

Enter the input : 4 + 1

The result: 5

aaaa@ubuntu:~$ ./test.sh

Enter the input : 4 / 9

The result: 0

aaaa@ubuntu:~$ ./test.sh

Enter the input : 4 - 10

The result: -6


이런식으로 결과 출력하는 사칙연산 계산기인데


#!/bin/bash


read -p "Enter the input: " x c y

if ["$c" = "+"]; then

let result=$x+$y

echo "result: " $result

elif ["$c" = "-"]; then

let result=$x-$y

echo "result: " $result

elif ["$c" = "*"];then

let result=$x*$y

echo "result: " $result

elif ["$c" = "/"]; then

let result=$x/$y

echo "result: " $result

fi


이렇게 하는거 맞아여?