Linux 判斷文件修改時間和系統時間差
#!/bin/bashtimestamp=`date +%s`filepath=/root/yuhui/ta-2016030307.logif [ -f $filepath ];thenecho "文件存在!路徑為:$filepath"filetimestamp=`stat -c %Y $filepath`echo "文件最后修改時間戳:$filetimestamp"timecha=$[$timestamp - $filetimestamp] if [ $timecha -gt 60 ];then echo '當前時間大于文件最后修改時間60秒' else echo '當前時間小于文件最后修改時間60秒' fielseecho "文件不存在或者您輸入的路徑有誤"fi
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
新聞熱點
疑難解答
圖片精選