![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Bridge Calculator 1.0 RC 1 (Default branch) | iBot | Software Releases - RSS News | 0 | 05-17-2008 07:50 PM |
| Bridge Calculator 0.9 (Default branch) | iBot | Software Releases - RSS News | 0 | 05-13-2008 07:10 PM |
| calculator program.. | sahithi_khushi | Shell Programming and Scripting | 2 | 12-14-2006 01:22 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Calculator
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. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|