A couple of days ago, I had need to write a BASH script that would take a screenshot once a minute and save it for my later review. This is what I came up with:
while [ 1 ];
do
scrot ./`date +%F_%k.%M`.png;
sleep 60;
done
The script starts by creating never-ending while loop. The scrot command takes a screenshot and saves it in the current working directory as the current date and time (e.g. 2011-03-15_18.56.png). The sleep command causes the script to pause for 60 seconds before looping again.
This script will run indefinitely until it is killed (I run it in a terminal and kill it by hitting ctrl+c).


