27 June 2021

From time to time it happens in my work to do some calculation and I use bc command.

The cool features bc are:

Example of usage

Just to have a clean environment start a container

docker run -it ubuntu /bin/bash
# apt update && apt install -y bc

Addition

# echo "2+1" | bc
3

Division no scale

# echo "scale=0;10/3" | bc
3

Division scale=9

# echo "scale=9;10/3" | bc
3.333333333

References