I need to put a small delay into a shell script. I'm looking for something smaller than "sleep" - a second is way too long. I want to sleep something like 10 milliseconds. I've tried "usleep" and "nanosleep", but the script doesn't recognize them.
I'm using the bash shell but I'm willing to switch to a different shell if it helps to find a command that will do the delay.
I tried the "sleep 0.1" suggestion, but it says "sleep: bad character in argument".
It seems like the other suggestions are "doing it the hard way" in terms of forcing the script to do a lot of other processing to in effect slow it down. But if there's no better way to do a small delay then I'll have to resort to that.
Is it possible that you have 2 different sleeps-- a builtin and a binary? Perhaps see if /bin/sleep (or some other appropriate location...) can be called directly.
I've never heard about builtin sleep. It's just not GNU sleep (BSD on Mac, or something else). The variant with perl is the best solution (on modern enough boxes).