Basic Calculator
BC: Basic Calculator
Save settings for bc, the Linux calculator
Use a ~/.bc file with contents:
scale=6
Execute this or put it in your bashrc:
$ export BC_ENV_ARGS=~/.bc
Explanation
In GNU/Linux, a basic calculator is bc from package bc. The normal output is displayed with zero values after the decimal point, so I like to adjust it to show me four numerals past the decimal point.
scale=6
You can use whatever scale you like.
With GNU bc, you can set the environment variable BC_ENV_ARGS to be the name of a file that bc should read on startup.
Add the following to your .bashrc file :
$ export BC_ENV_ARGS=$HOME/.bc
… or, if you need to load the standard math library, you can do this :
$ export BC_ENV_ARGS="-l $HOME/.bc"
Sources:
Saving settings for bc
Command Line Calculator , BC
Wiki: Run commands
Ubuntu Help: Environment Variables
Man Page: BC