How to do floating point arithmetic in Shell programming?

Status
Not open for further replies.

hafees

In the zone
:)
is there any direct method to do floating point arithmetics in shell programming ? using expr or something. pls help
 

GNUrag

FooBar Guy
You can use expr to evaluate expressions like you'd have seen in many shell tutorials.

But for floating point maths you can use the bc utility. GNU bc does not require the separate dc program, which is another GNU calculator utility

Read this example cum documentation to understand how to invoke and integrate bc with your shell script.
*www.gnu.org/software/bc/manual/html_mono/bc.html#SEC19
 
Status
Not open for further replies.
Top Bottom