[Bug 264162] /bin/sleep: Add optional units (seconds, minutes, hours, days)

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 22 May 2022 22:21:24 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264162

            Bug ID: 264162
           Summary: /bin/sleep: Add optional units (seconds, minutes,
                    hours, days)
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: mallorya@fastmail.com

Created attachment 234127
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=234127&action=edit
Allow passing optional units (seconds, minutes, hours, days) to /bin/sleep

`sleep` is more convenient when you can pass `5m` instead of `300`. It reduces
the cognitive load on the user if they don't have to make those conversions
themselves.

I spent a little while making a patch that mostly works (I'm no C programmer).
There are bugs - you can pass `1sx` and it will parse that as `1s` and ignore
the `x`. If this new feature is acceptable to the FreeBSD project, the
implementation would need some cleaning up.

I realize this is a feature that's present in GNU sleep. For the record, I read
the GNU sleep man page to see which units it supports but I did not read the
source of the program.

-- 
You are receiving this mail because:
You are the assignee for the bug.