#!/bin/sh
# images are continueously updated in a given directory [img_src_dir]
# use the `ls -t` command to find the latest image file
# use eog to show the latest image file dynamically
# In the eog Preferences/Slideshow, uncheck the "Loop sequence" option
# So EOG and Entangle can be used together
img_src_dir="/home/to/Capture"
img_dst_dir="/home/to/eog/img_dir"
test_img_path="$img_dst_dir/test.jpg"
# to ls files under a dir and sort by time
img_name=`ls -t $img_src_dir | head -1`
echo $img_name
img_src="$img_src_dir/$img_name"
cp $img_src $test_img_path
eog $test_img_path &
ls -l $img_dst_dir
while true
do img_name=`ls -t $img_src_dir | head -1`
img_src="$img_src_dir/$img_name"
cp $img_src $test_img_path
echo $img_src
echo $test_img_path
sleep 1
done