FILE -nt FILE (conditional operator)

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

-nt 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 newer than another file:
1
2
3
4
test ~/file1.txt -nt ~/file2.txt && echo "file1 is newer"
[ ~/file1.txt -nt ~/file2.txt ] && echo "file1 is newer"
# Bash
[[ ~/file1.txt -nt ~/file2.txt ]] && echo "file1 is newer"
BashSupport Pro ist eine Bash IDE mit Unterstützung für -ntprobieren Sie es aus!
© 2020–2024 Joachim Ansorg
Impressum
Datenschutz
Rechtliches