Linuxパソコン・サーバーのBashプログラミング言語(スクリプティング言語)上のコマンドラインにおいて、最後にフォルダの中のファイルが更新されてから何秒たったか出力する方法について紹介します。
calc3 " "$( date +"%s" )" - "$( find /mnt/e/_downloads/ -type f -printf '%Ts\n' | sort -r | head -1 )" "
yuis ASUS /mnt/c/pg$ types calc3 pythonprint3
alias calc3='pythonprint3'
pythonprint3 ()
{
python3 -c "print($1)"
}
以下で何時間たったかになる。
calc3 " ( "$( date +"%s" )" - "$( find /mnt/e/_downloads/ -type f -printf '%Ts\n' | sort -r | head -1 )" ) / ( 60 * 60 ) "
0.19111111111111112