#!/bin/bash
# script to run screencapture every one second
screenshot="$(which screencapture) -x -m -C"
freq=60 #take a screenshot every 30 seconds
maxshots=100000000000 #take 45 screenshots then quit
while getopts "af:m" opt; do
case $opt in
f ) freq=$OPTARG; ;;
m ) maxshots=$OPTARG; ;;
? ) echo "Usage: $0 [-f frequency] [-m maxcaps]" >&2
exit 1
esac
done
sleep 60
counter=1 #set startng number; incrementally append to filename
while [ $counter -le $maxshots ] ; do
da=`date +"%d:%m:%y-%H:%M"`
echo "done ${counter} date is : ${da}"
$screenshot "(${counter})${da}".jpg
counter=$(( counter + 1 ))
sleep $freq
done
exit
screenshot.sh0.6KB