My .bash_aliases file is populated with single-letter aliases (such as o for octave-cli
and r for sudo reboot
.
For a while I've been wanting to implement BASH's built-in calculator to do quick calculations, mostly integer multiplication and exponentiation. Sometimes I'll run echo $((expression))
in the terminal, however it would be great to make a shorthand for that, so that I could simply write
c expression
into a terminal. It would be ideal to declaire something like
alias c="echo $(($@))"
into the .bash_aliases file, however that does not work (it prints a 0 as well as the unsolved expression). In what ways do I have to modify the command above to make it possible for 'expression' c expression
to be passed onto echo $(($@))
. I've had the idea of including a function in the .bash_aliases file, however do not know how to correctly direct the argument.