1、实时查看指定日志目录最新文件记录
tail -f "$(find {指定的目录} -maxdepth 1 -name "{待查看文件的名称}" -printf "%Ts/%f\n" | sort -n | tail -1 | cut -d/ -f2)"
#示例
tail -f "$(find . -maxdepth 1 -name "iot*.log" -printf "%Ts/%f\n" | sort -n | tail -1 | cut -d/ -f2)"
#示例
LOG_FOLDER=/home/iot/jx_pro/data/logs
tail -f $LOG_FOLDER/"$(find $LOG_FOLDER -maxdepth 1 -name "iot*.log" -printf "%Ts/%f\n" | sort -n | tail -1 | cut -d/ -f2)"