#!/bin/bash
#The file type to store pictures as ( png, jpg, gif ...)
suffix=png
dir=~/snapshot
filename=snapshot
#Set up the directory
if ! [ -d $dir ];
then
  mkdir $dir
fi
#Find smallest unused number
i=1
while [ -f $dir/${filename}${i}.$suffix ]
do
  i=$(($i+1))
done
import -window root ${dir}/${filename}${i}.${suffix}
