Converting with units


Converting with units

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.

Code Listing 15.4. Use the units utility to find out how to convert from anything to anything elsereally!

[jdoe@frazz bin]$ units 1948 units, 71 prefixes, 28 functions You have: inch You want: feet         * 0.083333333         / 12 You have: [jdoe@frazz bin]$ 

To Convert with units:

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.





Unix(c) Visual Quickstart Guide
UNIX, Third Edition
ISBN: 0321442458
EAN: 2147483647
Year: 2006
Pages: 251

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net