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

Re: POSIX shell specification insight requested

> 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.

I do not know about POSIX, but there is a workaround which should work
in all shells:

foo=$(cat <<EOF
Foo bar baz quux

Does not look too pretty, but works, guaranteed.

Gergelybrush Nagywood

Reply to: