Path: utzoo!utgpu!watmath!att!cbnewsc!woods From: woods@cbnewsc.ATT.COM (Warren D. Swan) Newsgroups: comp.bugs.sys5 Subject: Re: ksh bugs Keywords: ksh Message-ID: <2316@cbnewsc.ATT.COM> Date: 8 Aug 89 18:58:21 GMT References: <10166@fluke.COM> Reply-To: woods@cblph.ATT.COM (Warren D. Swan) Distribution: na Organization: AT&T Bell Laboratories Lines: 48 In article <10166@fluke.COM> foot@tc.fluke.COM (Andrew Proudfoot) writes: >2. the "read" command does filename expansion on its input! > Just filename expansion; it doesn't do quote removal or tilde expansion. > This happens only on the Suns, not on the Vaxes. > > $ ls /usr0/foot/xx > file1 file2 file3 > $ ls ~foot/xx > file1 file2 file3 > $ while read stuff; do echo $stuff; done << EOF > > ~foot/xx/* > > '/usr0/foot/xx/*' > > /usr0/foot/xx/* > > EOF > ~foot/xx/* > '/usr0/foot/xx/*' > /usr0/foot/xx/file1 /usr0/foot/xx/file2 /usr0/foot/xx/file3 The other two sound like problems, but this one definitely isn't. This is not the read statement doing filename expansion. Nor is it, as someone ludicrously suggested without checking, the here document doing filename expansions, because the shell only does $ expansion on here documents [unless the sentinel (EOF) is quoted, even partially ('EOF' or \EOF)], NOT ` or filename expansions. The problem is in your reference to $stuff. One of the first rules of shell programming ought to be: Always quote any expansion of an environment or shell variable (unless you WANT something like the above to happen). Just change your while loop to read: $ while read stuff; do echo "$stuff"; done <