The Code
The script uses PHP (http://www.php.net), better known as a web
programming and templating language, on the command line, passing
your calculation query to Google, scraping the returned results, and
dropping the answer into your virtual lap.
TIP
This hack assumes that you have PHP installed on your computer and it
lives in the /usr/bin directory. If PHP is
somewhere else on your system, you should alter the path on the first
line accordingly (e.g., #!/usr/local/bin/php4).
#!/usr/bin/php
<?php
preg_match_all('{<b>.+= (.+?)</b>}',
file_get_contents('http://www.google.com/search?q=' .
urlencode(join(' ', array_splice($argv, 1)))), $matches);
print str_replace('<font size=-2> </font>', ',',
"{$matches[1][0]}\n");
?>
Save the code to a file called calc in your path
(I keep such things in a bin in my home
directory) and make it available to run by typing chmod +x
calc.