4 ms·
I use a function "ev" that wraps bc. It's crude, but handy: $ ev() { echo "scale=3; $*" | bc -l; } $ ev 22/7 3.142
by ibiza 6y ago
I use a function "ev" that wraps bc. It's crude, but handy:
$ ev() { echo "scale=3; $*" | bc -l; }
$ ev 22/7
3.142
- geraldcombs 6y agoI do something similar, with a couple of convenience substitutions for commas and multiplication: $ math() { echo "scale=2 ; $" | sed -e "s:x::g" | sed -e "s:,::g" | bc; } $ math 5,382 x 48,927.3 263326728.6
- majewsky 6y agoYou should put this into a codeblock by indenting by 2 spaces. The formatting converts asterisk-delimited text into italics. $ math() { echo "scale=2 ; $*" | sed -e "s:x:*:g" | sed -e "s:,::g" | bc; } $ math 5,382 x 48,927.3 263326728.6