Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

sleep $floatval



% float SleepDuration=0.3
% date; sleep $SleepDuration; date
Sat Aug 31 16:39:33 PDT 2013
Sat Aug 31 16:39:36 PDT 2013
%

So the float shows as 3.000000000e-01 which becomes a string, before
being passed to the built-in sleep, which then does not parse that
format as 0.3, nor show an error, but instead sleeps for 3 seconds
without an error.

I thought that sleep was a shell builtin, but apparently I thought
wrong.  Using "float -F SleepDuration" fixes it.

What do folks think about sleep being a builtin, which can take
arbitrary formats and avoid forking an extra process, just to delay?

Looking for a rough idea of whether people think the current behaviour
is problematic enough to make it worth adding another builtin.  And
should it be sleep or zsleep, if so?

-Phil



Messages sorted by: Reverse Date, Date, Thread, Author