Negative numbers and decimals
I am trying to be able to get the user to give me real and whole numbers and use these numbers to calculate into other variables. Sometimes I'll have to return a negative number. How do I do this?
|
Which language? Can you show us your code?
|
Oops sorry
Code:
#!/bin/bash |
So basically I want the user to be able to enter a price like 8.55 without it giving me an error for it not being an integer when the calculations start to happen. So I'm guessing there is some kind of option I need, but I don't know what it is. Also, when a "payment" equals more than the "total" I don't want it to error out.
|
Bash itself is not very good at dealing with floating point numbers. Have a look at:
http://stackoverflow.com/questions/9...n-shell-script For your other errors: http://stackoverflow.com/questions/4...rator-expected |
All times are GMT -5. The time now is 01:50 AM. |