Mike,
I usually test for the existance using:
if [ -f $file ]
then
echo "file exists"
fi
other variations of the test are
-r to see if it is readable
-x to see if it is executable
and then of course the all important ! to check for non-existance, e.g.
if [ ! -f $file ]
then
echo "file does not exist"
fi
Thanks,
Ian
>
> There are lots of ways to verify a file exists before acting on it. What is
> the cleanest and most efficient way to verify the existence of a file in a
> directory, from a script run from cron?
>
> my example: ls <file> && <execute program>
>
> Is there a better way?
>
> Michael C. Rock
>
This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 17:24:32 EDT