code:
1
2
3
4
5
6
7
8
| #! /bin/bash
if [ -n $(find ${1} -anewer ${2} -print) ]
then
echo ${1} is newer than ${2}
else
echo ${2} is newer than ${1}
fi |
Je kunt ook direct het commando 'newer' gebruiken. Vanuit perl (voor alles te gebruiken
) doe je dan iets als:
code:
1
2
3
4
5
6
7
8
9
| #!/usr/bin/perl
if (`newer file1 file2`)
{
print "file1 is newer than file2";
}
else
{
print "file1 is not newer than file2 (and probably older too!).
} |
Leven is het meervoud van lef | In order to make an apple pie from scratch, you must first create the universe.