Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Announcement draft



On Thu, 1 Aug 1996, Peter Stephenson wrote:

> 
> Anyone know the proper backslash rules for here documents?
> 

It depends on what "proper" rules are ;)

Here is relevant part form XPG4 Shell:

1. Section 2.7.4 (Here-document)

...
If no character in word are qouted, all lines of the here-document will be
expanded for parameter expansion, command substitution and arithmetic
expansion. In this case, the backslash in the input will behave as the
backslash inside double-quotes (see Section 2.2.3) However, the
double-quote character (") will not be treated specially within a
here-document, except when the double-quote appears within $(), ``, or
${}.

...

2. Section 2.2.3 (Double-quoting)

Characters to be treated specially in double-quotes:

$ - dollar sign
` - backquote
\ - backslash *only when followed by one of characters $ ` " \ <newline>*

...
In double-quote, if a backslash is immediately followed by a character
that would be interpreted as having special meaning, the backslash is
deleted and the subsequent character is taken literally. If a backslash
does not precede a character, that would have a special meaning, it is
left in place unmodified and the character immediately following it is
also left unmodified.
...

=== End of citation

It implies, that \" and \\" are the same in here-document. Wonder.

If it helps ...

greetings

-------------------------------------------------------------------------
Andrej Borsenkow 		Fax:   +7 (095) 252 01 05
SNI ITS Moscow			Tel:   +7 (095) 252 13 88

NERV:  borsenkow.msk		E-Mail: borsenkow.msk@xxxxxx
-------------------------------------------------------------------------





Messages sorted by: Reverse Date, Date, Thread, Author