Hi,
i want to add two decimal values to
$ set a= 12.4
$ set b=3.6
$ w=`expr $a - $b`
expr: non-numeric argument
or is there any other method to do this mathematics operation.
i need to use this into my script.
Hi,
i want to add two decimal values to
$ set a= 12.4
$ set b=3.6
$ w=`expr $a - $b`
expr: non-numeric argument
or is there any other method to do this mathematics operation.
i need to use this into my script.
This is quite a nice page on the subject
Floating Point Math in Bash | Linux Journal
---------- Post updated at 04:05 PM ---------- Previous update was at 03:44 PM ----------
When I tried these functions under ksh I had to remove the -q option for bc
Here is how to do it in ksh. No need to use expr or subshells.
$ a=12.4
$ b=3.6
$ w=$((a-b))
$ echo $w
8.8
That is true of ksh 93, in 88 the answer is 9
hi this is not working...
Its giving me an error.
w=$((a-b))
syntax error: `w=$' unexpected
can u suggest any other method