4 ms·
I like awk as a calculator: calc () { awk "BEGIN { print "$*" }" } $ calc "2^16" 65536 $ calc "2*16" 32 $ calc "2+16" 18
by icefog 7y ago
I like awk as a calculator:
calc () { awk "BEGIN { print "$*" }" }
$ calc "2^16"
65536
$ calc "2*16"
32
$ calc "2+16"
18
- udfalkso 7y agopython irb etc.
- Pete_D 7y agounits, too: $ units -t "sqrt(3^2 + 4^2)" 5 $ units -t "forty rods per hogshead" "miles per usgallon" 0.0019825576 $ units -t "32GB / (1MB/s)" "hours; minutes" 8;53.333333
- gowld 7y agohttps://en.wikipedia.org/wiki/Bc_(programming_language)#Using_bc_in_shell_scripts https://en.wikipedia.org/wiki/Bc_(programming_language)#Usin... $ bc -l <<< 2^16 65536 $ bc -l <<< 2*16 32 $ bc -l <<< 2+16 18