I am pretty new to the Unix word, and have created a working calculator script. I have one problem. It doesn't use any decimals, it rounds off to the nearest whole number.
1 \#!/bin/ksh
2 while true; do
3 echo -n "Enter the first integer: "; read IN1
4 test "$OP1" = "x" && exit 0
5 echo -n "Enter an operator: "; read OPR
6 test "$OPR" = "x" && exit 0
7 echo -n "Enter the second integer: "; read IN2
8 test "$OP2" = "x" && exit 0
9 RES=$\(expr "$IN1" "$OPR" "$IN2"\)
10 echo "Answer: $IN1 $OPR $IN2 = $RES";
11 done;
Any ideas? Thanks.