Bash Sleep vs. Wait

Both commands sound like they do the same thing but they are used in very different ways

Sleep

Stops script execution for a specified amount of time in seconds e.g sleep 30 will stop the script for 30 seconds before continuing.

Wait

Wait command pauses the script just like sleep but it waits for a process to complete regardless if it was success or failure e.g wait 123456 will wait for the process 123456 (PID).

About Danny

I.T software professional always studying and applying the knowledge gained and one way of doing this is to blog. Danny also has participates in a part time project called Energy@Home [http://code.google.com/p/energyathome/] for monitoring energy usage on a premise. Dedicated to I.T since studying pure Information Technology since the age of 16, Danny Tsang working in the field that he has aimed for since leaving school. View all posts by Danny → This entry was posted in Linux and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *.

All comments must go through an approval and anti-spam process before appearing on the website. Please be patience and do not re-submit your comment if it does not appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.