sleep—suspends execution for some number of seconds

sleep time

sleep suspends execution for time seconds. It is used to execute a command after a certain amount of time.

Example A.39.
1   (sleep 105; command)&
2   (In Script)
    while true
    do
       command
       sleep 60
    done

EXPLANATION

  1. After 105 seconds, command is executed. Prompt returns immediately.

  2. Enters loop; executes command and sleeps for a minute before entering the loop again.

Get UNIX® Shells by Example, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.