How to make a short delay (for less than a second) in bash? The smallest time unit in sleep command is 1 sec. I am using bash 3.0 in SunOS 5.10.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
SunOS (Solaris) probably doesn’t have the GNU tools installed by default. You might consider installing them. It’s also possible that they’re already installed in your system, perhaps in some directory that isn’t in your default
$PATH. GNUsleepis part of the coreutils package.If you have Perl, then this:
should sleep for 500000 microseconds (0.5 second) — but the overhead of invoking perl is substantial.
For minimal overhead, I’d write a small C program that calls
usleep()ornanosleep(). Note thatusleep()might not handle intervals greater than 1 second.