|
OOD, Out Of Date Utility |
A 'How To' Guide for the Nanopublisher |
OOD is used in shell scripts to determine if a file is out of date relative any file in a list of files.
Given a file and a list of files, OOD returns a status of 1 if the file is older than any file in the list or if it does not exist. Otherwise it returns 0 unless there are errors in the command line, in which case it returns 2. If a name in the file list is preceeded with an -x, it is treated as the name of an executable file and your path is searched to find it.
OOD is useful in shell scripts for determining when a file that is derived from other files is out of date relative to those files. For example, here is a fragment of csh script that performs regression testing on a program prog. The tests are only run if either the program or the test itself has changed since the last time it was run. This is particularly helpful if running a testcase is time consuming and you are actively developing the testcases.
foreach test (test1 test2 test3 test4)
ood $test.out $test $test.ref -x prog
if ($status) then
echo "running $test"
prog $test > $test.out
cmp $test.out $test.ref
endif
end
ood target file [...]
| target | The file to be tested |
| file | File or files that the target is compared against |
| -x | If a file other than the target is preceded with -x, it is considered to be an executable and the PATH is searched to find the file. |
The code runs under various flavors of Unix (ex. Linux). For people with Windows, it can be run under Cygwin.
After downloading, unpack the archive with
tar zxf ood.tgz
Compile it with
cd fvi make fresh
Install with (you may need to be root to do this)
make install
Any questions or comments on these notes can be directed to theNurds@nurdletech.com.