Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.bugs.sys5 Subject: Re: ksh bugs Keywords: ksh Message-ID: <2363@auspex.auspex.com> Date: 16 Aug 89 17:36:10 GMT References: <10166@fluke.COM> <2316@cbnewsc.ATT.COM> Reply-To: guy@auspex.auspex.com (Guy Harris) Distribution: na Organization: Auspex Systems, Santa Clara Lines: 57 >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. That may be true of filename expansion - I don't have a Korn shell handy to check - but it is definitely *not* true of ` expansions, which are referred to as "command substitution" in the Bourne shell manual page. At least in the S5R3 Bourne shell, command substitution is performed in here documents. (Try $ sed 's/Wed/Wednesday/' << EOF > `date` > EOF I got "Wednesday Aug 16 10:15:53 PDT 1989" printed out. This happened with both the Bourne and C shells.) You can also check the manual page: <<[-]word After parameter and command substitution is done on "word", the shell input is read up to the first line that literally matches the resulting word, or to an end-of-file. If, however, `-' is appended to <<: 1) leading tabs are stripped from "word" before the shell input is read (but after parameter and command substitution is done on "word"), 2) leading tabs are stripped from the shell input as it is read and before each line is compared with "word", and 3) shell input is read up to the first line that literally matches the resulting "word", or to an end-of-file. If any character of "word" is quoted (see "Quoting", later), no additional processing is done to the shell input. If no characters of word are quoted: 1) parameter and command substitution occurs, 2) (escaped) \new-line is ignored, and 3) \ must be used to quote the characters \, $, and `. The resulting document becomes the standard input. or you can check the code, and they all agree that command substitution *IS* done in here documents. If the Korn shell doesn't do command substitution in here documents, I would consider that to be a bug, since the Bourne shell does it....