我想在 linux bash 中检查一个文件是否是在 x 之前创建的。
假设文件名为 text.txt,时间为 2 小时。
if [ what? ]
then
echo "old enough"
fi
最佳答案
仅用于修改时间
if test `find "text.txt" -mmin +120`
then
echo old enough
fi
您可以使用 -cmin
更改或 -amin
访问时间。正如其他人指出的那样,我认为您无法跟踪创建时间。
https://stackoverflow.com/questions/552724/