How to get decimal values ?

Hi All,

In my script I've written like this-

c=$( expr 100 / 3);echo $c

The output coming is 33. but I want to see 33.33, decimal values too. How to get that?

Thanks,
Naresh

a=$(echo"scale=2;100/3"|bc);echo  $a
33.33

Try this,

c=$(echo "scale=2;100/3" |bc);echo $c

Sorry previous post was not there when I checked.

Thank you very much, it worked fine. :slight_smile: