?

Log in

No account? Create an account

Previous Entry | Next Entry

float computation

As "expr" does not help in float computations, here are some of the alternatives

Using bc
$ Number=`echo 80 \* 10.69 bc`; echo $Number

Using AWK
$ Number=`(echo awk '{ print 80*10.69}')`; echo $Number
855.2

And if you are supplying something from outside
$ S=80; Number=`echo awk '{ print "'"$S"'"*10.69}'` ; echo $Number
855.2

One more way of passing variables to AWK
$ S=80; Number=`echo awk -v K=$S '{ print K*10.69}'` ; echo $Number
855.2

Profile

jaduks
Jadu Kumar Saikia

Latest Month

January 2008
S M T W T F S
  12345
6789101112
13141516171819
20212223242526
2728293031  
Powered by LiveJournal.com
Designed by chasethestars