3

I would like to create an alias for bc that runs bc -l and specifies that pi=4*a(1). This way, I can start each session with pi already defined. What alias will do this?

3

I will answer your Question, but you should consider following the link provided by Julie Pelletier

assuming you are using bash:

alias bc-l-with-pi='bc -l <(echo "pi=4*a(1)")'

explanation:

we (ab)use the bash redirection to give bc a temporary file with the content "pi=4*a(1)". after that bc goes into interactive mode.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.