Friday, February 12, 2016

interrupt sleep in a bash script

For testing you have added sleep command in a script.

Now, you want to interrupt the sleep and continue to next statement.

How do you do it?

 Method 1:
If sleep is only done in your script alone, you can do this:
pkill sleep
Method 2: (need changes in script) 

--------------------- // this is your script
# write the current session's PID to file
echo $$ >>

# go to sleep for a long time
sleep 1000

# pkill -P $(< sleep 


No comments:

Post a Comment