bc command is used for command line calculator. It is similar to basic calculator by using which we can do basic mathematical calculations. Arithmetic operations are the most basic in any kind of programming language.
What does the bc command do?
The bc command allows you to specify an input and output base for operations in decimal, octal, or hexadecimal. The default is decimal. The command also has a scaling provision for decimal point notation. The bc command always uses the .
How do you write a bc command in Unix?
Overview. A typical interactive usage is typing the command bc on a Unix command prompt and entering a mathematical expression, such as (1 + 3) * 2 , whereupon 8 will be output. While bc can work with arbitrary precision, it actually defaults to zero digits after the decimal point, so the expression 2/3 yields 0 .