Sample Header Ad - 728x90

How do I tell the "units" command to use a different length unit by default?

2 votes
1 answer
105 views
By default, the GNU units command outputs length units in meters. If I want to use a different unit, I have to specify this manually at the You want: prompt. Is there a way to change the default from meters to something else? $ units Currency exchange rates from FloatRates (USD base) on 2020-07-08 3496 units, 109 prefixes, 109 nonlinear units You have: (1gallon)^(1/3) You want: Definition: 0.15584913 m In the above example, I might want this interaction, with empty You want: input, to produce the output Definition: 0.51131604 ft or Definition: 6 in + 1.0863395 * 1|8 in. At present, I only know how to get these outputs by specifying ft or ftin explicitly: You have: (1gallon)^(1/3) You want: ft * 0.51131604 / 1.9557376 You have: (1gallon)^(1/3) You want: ftin 6 in + 1.0863395 * 1|8 in It seems like it should also be possible to configure these as defaults using a command line option like --units, or an environment variable like UNITS_SYSTEM, or an entry in ~/.units.
Asked by Metamorphic (1219 rep)
Oct 5, 2020, 08:27 PM
Last activity: Oct 6, 2020, 08:27 PM