[CentOS] units command, crazy output

Thu Dec 31 05:59:24 UTC 2020
Jon LaBadie <jcu at labadie.us>

On Wed, Dec 30, 2020 at 06:20:28PM -0500, Fred wrote:
> whenever I use the units command from a script, e.g.:
> 
> elapsed=86500
> echo elapsed time: `units "$elapsed sec" hms`
> elapsed time: *Currency exchange rates from 2012-10-24* 24 hr + 1 min + 40
> sec
> 
> the man page even says it outputs that when run without arguments.
> 
> My question is why in the world does it? certainly when run from within a
> script doing conversions of time using the "hms" option, I don't want that
> to be stuck in the middle of my output.
> 
> Anybody know why it does that, or how to make it quit? (I know, I use sed
> to filter it out, but can't understand why I should have to.
> 
> Thanks in advance!
> 
You might consider terse output:

$ units -t '86500 sec' hms
24;1;40

jl
-- 
Jon H. LaBadie                  jcu at labadie.us