Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

echo "expression" | bc -l

:)



In zsh at least, you can do also do:

echo $((expression))

It will treat values as integers by default I think, so $((1/2)) evaluates to zero. But $((1./2)) treats the 1. as something else, I guess probably a float, and so produces .5.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: