3 ms·
I got tired of typing bc -l years ago, I have a function so I can do it on the command line: calc 2^27 + 3^15. I wish somehow the shell would let me add pare
by rnk 3y ago
I got tired of typing bc -l years ago, I have a function so I can do it on the command line: calc 2^27 + 3^15. I wish somehow the shell would let me add parens here, instead of having to escape them with a quote.
function calc2
{
if [ $# -eq 0 ];
then echo 'pass commands for math evaluation, like calc l(2^32/17) + 3';
fi;
echo $* | bc -l;
}
- squigz 3y agoThis is what I've had in my bashrc for a few years: = () { printf "%'.f\n" $(echo $1 | bc); }; alias calc==