Path: utzoo!attcan!uunet!lll-winken!csd4.milw.wisc.edu!mailrus!purdue!bu-cs!bloom-beacon!oberon!ucla-cs!das From: das@lanai.cs.ucla.edu Newsgroups: comp.unix.questions Subject: Idiom for $(ls -d $pattern 2>/dev/null) Message-ID: <21939@shemp.CS.UCLA.EDU> Date: 17 Mar 89 20:28:24 GMT Sender: news@CS.UCLA.EDU Reply-To: das@CS.UCLA.EDU (David Smallberg) Organization: UCLA Computer Science Department Lines: 10 Do you have a favorite idiom for (ksh syntax): $(ls -d $pattern 2>/dev/null) that does not involve invocation of a separate process and is not aesthetically unpleasant? The intent is that if any filenames match the pattern, then use them; otherwise, use the null string. This shows up when you want to say for f in * (Which is not what you really want, since if the directory is empty, f takes on the value "*"). -- David Smallberg, das@cs.ucla.edu, ...!{uunet,ucbvax,rutgers}!cs.ucla.edu!das