3 ms·
I recommend the "-1" (also called "--one-line") flag for bc. It takes away the extra (to me) reciprocal conversion factors. (Note: it's the number one, not a l
by adrianmonk 6y ago
I recommend the "-1" (also called "--one-line") flag for bc.
It takes away the extra (to me) reciprocal conversion factors. (Note: it's the number one, not a lowercase "L".)
Without:
$ units
Currency exchange rates from FloatRates (USD base) on 2019-05-31
3460 units, 109 prefixes, 109 nonlinear units
You have: inch
You want: cm
* 2.54
/ 0.39370079
You have:
With:
$ units -1
Currency exchange rates from FloatRates (USD base) on 2019-05-31
3460 units, 109 prefixes, 109 nonlinear units
You have: inch
You want: cm
* 2.54
You have:
To me the reciprocals are just clutter. If I want a reciprocal, I will just type the two parts of my query in the opposite order. I'd even say they're confusing because you have to look at them understand why there are two numbers.
(Also on the subject of flags, I'd like one that suppresses the first two lines of output but not the prompts like "You have:".)
- scaladev 6y agoDid you paste that printout from a recent run of units? If so, the currency rates are pretty useless. You can configure the system to update them daily (or however you like) with something like this: $ cat /etc/systemd/system/units-currency-update.service [Unit] Description=Update units(1) currency rates [Service] Type=oneshot Nice=19 ExecStart=/usr/bin/units_cur $ cat /etc/systemd/system/units-currency-update.timer [Unit] Description=Update units(1) currency rates [Timer] OnCalendar=daily AccuracySec=3h RandomizedDelaySec=3h Persistent=true [Install] WantedBy=timers.target # systemctl daemon-reload # systemctl enable units-currency-update.timer
- boogies 6y agoOr just something like 0 0 * * * nice -n 19 /usr/bin/units_cur for *BSD crontabs or both HN users (besides me) who prefer systemd-free distros of GNU
- adrianmonk 6y agoCorrections (b/c too late to edit): (1) The flag isn't for bc, of course; it's for units. I'm always running the wrong one, so no surprise I mixed them up again. (2) Should read "look at them to understand" near the end.