sh 使用EOG动态显示给定目录下的最新映像文件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 使用EOG动态显示给定目录下的最新映像文件相关的知识,希望对你有一定的参考价值。

#!/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

以上是关于sh 使用EOG动态显示给定目录下的最新映像文件的主要内容,如果未能解决你的问题,请参考以下文章