Difference between revisions of "Bc"
From Notes_Wiki
m |
m |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Main_Page|Home]] > [[Shell scripting]] > [[Bc|bc]] | |||
'<tt>bc</tt>' is an arbitary precision calculator for Linux. It is very useful as normal shell arithmetic is very limited. For example shell does not supports division of real numbers. | '<tt>bc</tt>' is an arbitary precision calculator for Linux. It is very useful as normal shell arithmetic is very limited. For example shell does not supports division of real numbers. | ||
Line 25: | Line 24: | ||
exit 0 | exit 0 | ||
</pre> | </pre> | ||
[[Main_Page|Home]] > [[Shell scripting]] > [[Bc|bc]] |
Latest revision as of 13:41, 7 April 2022
Home > Shell scripting > bc
'bc' is an arbitary precision calculator for Linux. It is very useful as normal shell arithmetic is very limited. For example shell does not supports division of real numbers.
Using bc to perform divison of real numbers in shell script
Example script which uses 'bc' to divide two numbers is:
#!/bin/bash Numerator=5 Denominator=2 Quotient=$(bc <<END scale=20 $Numerator/$Denominator quit END ) echo "Result is $Quotient" exit 0
Home > Shell scripting > bc