FILE -ot FILE (conditional operator)

true if file1 is older than file2, based on the modification date.

-ot is not included in POSIX. Avoid it if you want to stay compatible with POSIX shells.

Examples

Different ways to test if a file is older than another file:
1
2
3
4
test ~/file1.txt -ot ~/file2.txt && echo "file1 is older"
[ ~/file1.txt -ot ~/file2.txt ] && echo "file1 is older"
# Bash
[[ ~/file1.txt -ot ~/file2.txt ]] && echo "file1 is older"
BashSupport Pro 是一个 支持 -ot 的 Bash 集成开发工具 – 马上试用
© 2020–2024 Joachim Ansorg
声明
隐私政策
许可条款