I found a script online to take screen shots at timed intervals (I'm using it to make timelapse videos). I do not know anything about this stuff, so I'm hoping someone here can help.

Basically, I want to be able to pause and resume this script somehow. Instead of stopping it when needed, checking the screen shot folder for the last numbered file, back go Terminal, UP arrow to see last command, CTRL + A to go to the beginning, changing i=1; to last file number, Enter.

That's quite inconvenient as I have to do it every time I check instant messages and what not.

Here's the script:

while [ 1 ];do 
screencapture -t png -x ~/Pictures/screenshots/$(printf "%05d" $i).png; 
let i++;
sleep 2;