Weeknotes: Week of March 20, 2022·
bc for quick math in the terminal!
Do math in the terminal with
bc! Just create a file that has your desired math
operations, create variables just like you expect with
<var> = <expression>,
and output an expression by putting it on a line by itself.
total = 1 + 2 + 3 total * 2 quit
And now execute it:
$ bc -q myfile.bc 12
Or do even quicker math by piping to
$ echo "2 * 2" | bc 4