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

Re: POSIX shell specification insight requested



On Tue, Mar 02, 2004 at 12:47:15PM -0600, Manoj Srivastava wrote:
> 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)
> 
> ======================================================================
> 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
>      results 
> ======================================================================
> 
> 	The here document is a redirection, hence the reults of that
>  command substitution are unspecified.

"cat <<EOF" is not "a script consisting solely of redirections". It
contains a redirection, but does not consist solely of one.

Cheers,

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: