On Tue, Jul 31, 2001 at 09:03:17AM -0400, Mikes work account wrote:
>
> 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?
test -f <file> && ...
or test by another name:
[ -f <file> ] && ...
[ = test, with the requirement that it eventuallt encounters a closing ]
check out man test or man [ it does many other tests, too.
This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 17:24:47 EDT