Suspending commands with the sleep command

To suspend the execution of a command for a specific amount of time use the command:

   sleep time_in_seconds; command

The second command will not be carried out until the amount of time specified as an argument to the sleep command has elapsed. The semicolon (;) is used to allow the two commands to be entered on the same command line.

You can also enclose the commands in parentheses to group them together and then run the combined command in the background, allowing you to carry on working at the shell prompt:

   (sleep time_in_seconds; command) &

This command is very useful if you need to do something else before a command is executed.


[Home] [Search] [Index] This site maintained by unixhelp@mathcs.duq.edu