ksh: Checking for file existence

Ross Druker RS0VRD at ROHVM1.BITNET
Sat Jun 15 01:51:09 AEST 1991


Of course, after posting this, I walked away for 20 minutes, then
came back and thought of a simple way of doing this.  Forgetting
about the "test" command, doing

if ls *.data > /dev/null 2>&1

returns true if any files exist and redirects standard out and standard
error to null.

But I'm curious as to whether there's any other way.  Sorry for the
wasted time if not.



More information about the Comp.unix.shell mailing list