Suspending commands with the sleep command

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@math.rutgers.edu
This page was last updated on September 05, 2006 at 10:29 am and is maintained by webmaster@math.rutgers.edu.
For questions regarding courses and/or special permission, please contact mclausen@math.rutgers.edu.
For questions or comments about this site, please contact help@math.rutgers.edu.
© 2012 Rutgers, The State University of New Jersey. All rights reserved.