Do you always forget how many drams there are in an ounce? Never fear. The units utility makes converting measurements a snap. See Code Listing 15.4 to learn how to convert with units.
[jdoe@frazz bin]$ units 1948 units, 71 prefixes, 28 functions You have: inch You want: feet * 0.083333333 / 12 You have: [jdoe@frazz bin]$ |
1. | units At the shell prompt, type units. The Unix system will prompt you with “You have:” as shown in Code Listing 15.4. |
2. | inch Enter the units you’re starting with. You’ll then be prompted with “You want:” |
3. | feet Enter the kind of units you want, and watch with amazement as Unix counts on its fingers and toes to figure out the answer. |
4. | Quit units when you’re done. |
✓ Tips
You can create your own units file, if you want, defining relationships between units and values of constants. This way, if the value of pi changes, you can create your own file with the new value. Do man units for more information.
Mess around with units much, and you’ll be astounded at the many units it can convert.