Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ucbvax!agate!usenet.ins.cwru.edu!ysub!psuvm!cunyvm!rohvm1!rs0vrd From: RS0VRD@ROHVM1.BITNET (Ross Druker) Newsgroups: comp.unix.shell Subject: ksh: Checking for file existence Message-ID: <91165.101842RS0VRD@ROHVM1.BITNET> Date: 14 Jun 91 15:18:42 GMT Organization: Rohm and Haas Company Lines: 43 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. I was trying to use the "test" command. This HP-UX does NOT have the [[...]] operator, even though this was supposedly available after 1986 versions of ksh, :-( I would like to do: if test -r *.data But ksh barks back with a syntax error. test doesn't like wildcards. I've been trying to get around this, playing with quotes, etc. The last thing I tried was to assign the list of filenames to a variable, as in: filelist=*.data What I've discovered is that ksh does NOT assign the corresponding string to filelist. In the csh world you'd get a wordlist. For instance, in csh, if there were files a.data and b.data, echo $filelist AND echo "$filelist" both return: a.data b.data But in ksh, echo $filelist returns: a.data b.data and echo "$filelist" returns: *.data The filelist variable never takes on the value of the filenames really. I was heading this way to possibly try and extract the first filename from the variable and see if I could use that somehow. But then I ran into this. Sorry to be so verbose, but does anyone have the answer that I'm too blind to see? Ross Druker Rohm and Haas Co. rs0vrd@rohmhaas.com