I like the interactive mode of the bc
command line calculator because it is ubiquitous, but wanted to augment its functionality a bit to add a couple features I liked from another calculator program. I wanted to make modifications to the text I typed before sent to bc
and modify the text it outputted. This can be done on standard POSIX shells with mkfifo
, but it took me a good while to figure out how to do this with both input and output and get something working nicely without it freezing or leaving artifacts. So I’m sharing how to do this in a bash
script.
math posts
Simple shell calculator
I’ve made myself a simple command line calculator using bc
.