Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!news.cs.indiana.edu!ux1.cso.uiuc.edu!midway!clout!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.unix.shell Subject: Re: ksh: Checking for file existence Message-ID: <1991Jun15.031252.6351@chinet.chi.il.us> Date: 15 Jun 91 03:12:52 GMT References: <91165.101842RS0VRD@ROHVM1.BITNET> Organization: Chinet - Chicago Public Access UNIX Lines: 19 In article <91165.101842RS0VRD@ROHVM1.BITNET> RS0VRD@ROHVM1.BITNET (Ross Druker) writes: >I have what may be a trivial problem, but I haven't solved it yet. >I'm using the Korn shell a script on an HP-UX system. I would like >to check for the existence of ANY data files, not a specific file. >if test -r *.data This should work with sh or ksh: FILES=`echo *.data` if [ "*.data" = "$FILES" ] then : # no match else for i in $FILES do ... process them... done fi Les Mikesell les@chinet.chi.il.us