This is a converter. It gives you conversion factors for feet to
inches, miles to meters, that sort of thing. It can be used
directly at the command line or interactively. You can modify the
data file it uses or create your own for special
bash-2.05a$ units ton grain * 14000000 / 7.1428571e-08 bash-2.05a$
Which tells you that you'd need to multiply by 14000000 to convert tons to grains. Interactively:
bash-2.05a$ units 501 units, 41 prefixes You have: 4 meters You want: inches * 157.48031 / 0.00635 You have:
The /usr/share/misc/units.lib (could be different on your system) is the file that tells units how to do its conversions; you can add to that or provide your own file:
bash-2.05a$ cat med aspirin !a! headache 2 aspirin bash-2.05a$ units -f med headache aspirin * 2 / 0.5
Units can only do simple math; it can't convert Fahrenheit to Centrigrade. It can do currency conversions, but you'd need to keep its file up to date.
Of course today we have Google, which can answer many such problems itself or find you a calculator to do it.
Got something to add? Send me email.
Increase ad revenue 50-250% with Ezoic