[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: POSIX shell specification insight requested

On Tue, 2 Mar 2004 13:04:43 -0500, Branden Robinson <branden@debian.org> said: 

> Is the following construction POSIXly correct?  foo=$(cat <<EOF Foo
> bar baz quux.  EOF)

> ash (and dash, which is derived from ash) choke on this, and seem to
> ignore everything on the same line as, but after, the here-document
> terminator word.

> bash (--posix) and (pd)ksh have no problem with it.

> I would be most grateful if someone access to the POSIX spec could
> provide some insight into this.

ISO/IEC 9945-2:1993(E)  Information Technology -- POSIX
IEEE Std 1003.2-1993    Part 2: Sheel and utilities

§ 3.6.3  Command substitution


lines 474-477

 Within the $(command) form, all characters following the open
 parenthesis to the  matching closing parenthesis constitute the
 /command/. Any valid shell script can be used for /command/, except

  -- A script consisting solely of redirections produces unspecified

	The here document is a redirection, hence the reults of that
 command substitution are unspecified.

If you would understand your own age, read the works of fiction
produced in it.  People in disguise speak freely.
Manoj Srivastava   <srivasta@debian.org>  <http://www.debian.org/%7Esrivasta/>
1024R/C7261095 print CB D9 F4 12 68 07 E4 05  CC 2D 27 12 1D F5 E8 6E
1024D/BF24424C print 4966 F272 D093 B493 410B  924B 21BA DABB BF24 424C

Reply to: