Console Interface to Google Calculator

for calculating stuff

As suggested by xkcd creator Randall Munroe, here is a command-line utility for interfacing Google Calculator.

It receives the query on stdin and tries to parse Google's reply on stdout.

It works with Bourne shells (unix sh) and needs wget (to make web queries) and sed (to parse the reply).

It does not yet handle full HTML decoding, meaning that stuff such as 3e5 will appear as 3 #something 10<sup>5</sup>.

Adaptation for taking a command line argument instead of stdin is trivial.

The code is GPL v.2. Lazy to paste the license header in the file, and besides, it's bigger than the useful content.


$chmod +x

Example usage:

 $ echo '2*pi*6 meters/(day*arcsec(6 meters/(radius of earth)+1))' | ./
(2 * pi * (6 meters)) / (day * arcsec(((6 meters) / radius of Earth) + 1)) = 0.318106531 m / s


defective technology,
defective people