Difference between revisions of "Shell Commands/Newer"
From MorphOS Library
(Created page with "'''Newer''' - Compares if a file is newer than an another file in shell scripts OLDFILE/A, NEWFILE/A, FILEDATES=DATES/S <nowiki> OLDFILE - An old existing file NEWFILE -...") |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
− | '''Newer''' - Compares if a file is newer than | + | '''Newer''' - Compares if a file is newer than another file in shell scripts |
OLDFILE/A, NEWFILE/A, FILEDATES=DATES/S | OLDFILE/A, NEWFILE/A, FILEDATES=DATES/S | ||
Line 7: | Line 7: | ||
FILEDATES - Compares file dates if there isn't difference in the version string | FILEDATES - Compares file dates if there isn't difference in the version string | ||
</nowiki> | </nowiki> | ||
− | If the NEWFILE is detected to be newer than the OLDFILE, the command exits with the return code 5. | + | If the NEWFILE is detected to be newer than the OLDFILE, the command exits with the return code 5 (WARN). If version information isn't found and the FILEDATES option isn't used, the command exits with the return code 10 (ERROR). And if a file isn't found, the return code is 20 (FAIL). |
Latest revision as of 20:54, 28 January 2016
Newer - Compares if a file is newer than another file in shell scripts
OLDFILE/A, NEWFILE/A, FILEDATES=DATES/S
OLDFILE - An old existing file NEWFILE - A new file to be checked if it is newer than the old file FILEDATES - Compares file dates if there isn't difference in the version string
If the NEWFILE is detected to be newer than the OLDFILE, the command exits with the return code 5 (WARN). If version information isn't found and the FILEDATES option isn't used, the command exits with the return code 10 (ERROR). And if a file isn't found, the return code is 20 (FAIL).
Example:
Newer RAM:oldfile RAM:newfile DATES If WARN Echo "The file is newer!" EndIf