Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!ukc!warwick!cudcv From: cudcv@warwick.ac.uk (Rob McMahon) Newsgroups: comp.unix.shell Subject: Re: ksh: Checking for file existence Message-ID: <2HX{2#_@warwick.ac.uk> Date: 19 Jun 91 09:12:25 GMT References: <91165.101842RS0VRD@ROHVM1.BITNET> <1991Jun15.031252.6351@chinet.chi.il.us> Sender: news@warwick.ac.uk (Network news) Organization: Computing Services, Warwick University, UK Lines: 34 Nntp-Posting-Host: shark In article <1991Jun15.031252.6351@chinet.chi.il.us> les@chinet.chi.il.us (Leslie Mikesell) writes: >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 ... unless you've got a file called `*.data', or a file with a space in the name ... how about set - *.data if [ "$*" = "*.data" -a ! -f "*.data" ] then : no files else for i do ... process them ... done fi Yuck, Rob -- UUCP: ...!mcsun!ukc!warwick!cudcv PHONE: +44 203 523037 JANET: cudcv@uk.ac.warwick INET: cudcv@warwick.ac.uk Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England