Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get decimal value from divide in fish shell

Tags:

fish

math 5/2 returns 2.

I want 2.5 -- how do I get decimal values?

like image 512
Abhilash Avatar asked Mar 17 '14 14:03

Abhilash


1 Answers

You can "force" math to return fractions by default -- use the -l option to bc:

$ math 5/2
2

$ function bc
      command bc -l $argv
  end

$ math 5/2
2.50000000000000000000
like image 86
glenn jackman Avatar answered Sep 24 '22 10:09

glenn jackman