4 ms·
I'm surprised this person didn't switch to using wcalc, instead of awk. For comparison: fao_@blob:~$ time $(echo '' | awk '{print (2*-1)}' >/dev/null) real 0m
by fao_ 5y ago
I'm surprised this person didn't switch to using wcalc, instead of awk. For comparison:
fao_@blob:~$ time $(echo '' | awk '{print (2*-1)}' >/dev/null)
real 0m0.006s
user 0m0.006s
sys 0m0.000s
fao_@blob:~$ time $(wcalc '2*-1' >/dev/null)
real 0m0.005s
user 0m0.001s
sys 0m0.005s
I'd imagine you could use something like xargs to insert the number so that wcalc can interpret the bits for you
- folmar 5y agoThe results you post don't seem to differ much, do you mean the difference is bigger as the inputs get larger? Spawning an extra subshell inside 'time' seems strange, as does using echo instead of </dev/null. Also: people wiriting things in bash usually try not to rely on utilities that are not present by default, and wcalc is not.
- alufers 5y agoI think it's supposed to run on BusyBox.