Mac os X Screencapture loop, bash script

Alec Jacobson

July 11, 2011

weblog/

Here's a simple bash script that grabs screen captures at a specified interval and saves them to files:
#!/bin/bash
# ./screencapture_loop delay_in_seconds file_name_prefix
x=1;
while :
do
  screencapture -C -m $2-`printf "%03d" $x`.png
  x=$(( $x + 1 ));
  sleep $1
done