Manually creating a bc profile.

Apparently, bc does not have a hidden environment file or profile that it uses. For example, bash has .bash_profile and .bashrc. I am fortunate that bc "starts by processing code from all the files listed on the command line..." [from the man page].

Because I am very tired to typing scale=3 every time I start bc, I did the following.

  1. Made a file named .bc in my HOME directory.
  2. Put scale=3 as the contents of .bc.
  3. Created an alias in my ~/.bashrc for bc to process my $HOME/.bc file.


[me@mybox myhome]$ grep alias ~/.bashrc
alias bc='bc ~/.bc'
[me@mybox myhome]$ cat ~/.bc
[me@mybox myhome]$ bc

No comments:

Post a Comment