# How to avoid \\ escaping when using "= \<\<-EOF"?

**URL:** <https://www.ruby-forum.com/t/how-to-avoid-escaping-when-using-eof/180832>\
**Category:** Ruby\
**Created:** [December 30, 2009, 1:39am UTC](https://www.ruby-forum.com/t/how-to-avoid-escaping-when-using-eof/180832 "2009-12-30T01:39:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ISSSSaki\_Baz\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/51bf81/32.png) [@ISSSSaki\_Baz\_C](https://www.ruby-forum.com/u/ISSSSaki_Baz_C)\
**Post date:** [December 30, 2009, 1:39am UTC](https://www.ruby-forum.com/t/how-to-avoid-escaping-when-using-eof/180832/1 "2009-12-30T01:39:27Z")

</div>

Hi, the following code

* * *

## banner = \<\<-EOF // EOF puts banner

produces:

* * *

## //

How could I avoid the “” scaping so the text appears verbatim?  
Thanks a lot.

---

<div class="post-metadata">

**Author:** ![ISSSSaki\_Baz\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/51bf81/32.png) [@ISSSSaki\_Baz\_C](https://www.ruby-forum.com/u/ISSSSaki_Baz_C)\
**Post date:** [December 30, 2009, 2:10am UTC](https://www.ruby-forum.com/t/how-to-avoid-escaping-when-using-eof/180832/2 "2009-12-30T02:10:29Z")

</div>

On 2009-12-30, Iñaki Baz C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> How could I avoid the "" scaping so the text appears verbatim?  
> Thanks a lot.

If any part of the listed modifier for the here document is quoted,  
the here document acts like single quotes:

cat \<\<-‘EOF’  
foo\bar$baz  
EOF  
=\>  
foo\bar$baz

(Note that the stripping of whitespace from the ‘-’ still takes effect.)

-s

---

<div class="post-metadata">

**Author:** ![ISSSSaki\_Baz\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/51bf81/32.png) [@ISSSSaki\_Baz\_C](https://www.ruby-forum.com/u/ISSSSaki_Baz_C)\
**Post date:** [December 30, 2009, 11:55pm UTC](https://www.ruby-forum.com/t/how-to-avoid-escaping-when-using-eof/180832/3 "2009-12-30T23:55:12Z")

</div>

Hi,

Am Mittwoch, 30. Dez 2009, 10:10:05 +0900 schrieb Seebs:

> =\>  
> foo\bar$baz

`cat’ is a shell command. I suppose you meant something like

mystr = \<\<-‘EOT’  
hello  
EOT

> (Note that the stripping of whitespace from the ‘-’ still takes effect.)

The `-’ just means that an indented “EOT” will close the here  
document; without it the “EOT” has to start in column 1. No  
whitespace will be stripped inside the string.

Bertram

---

<div class="post-metadata">

**Author:** ![ISSSSaki\_Baz\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/51bf81/32.png) [@ISSSSaki\_Baz\_C](https://www.ruby-forum.com/u/ISSSSaki_Baz_C)\
**Post date:** [December 30, 2009, 11:56pm UTC](https://www.ruby-forum.com/t/how-to-avoid-escaping-when-using-eof/180832/4 "2009-12-30T23:56:22Z")

</div>

On 2009-12-30, Bertram S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Am Mittwoch, 30. Dez 2009, 10:10:05 +0900 schrieb Seebs:
> 
> > If any part of the listed modifier for the here document is quoted,  
> > the here document acts like single quotes:
> > 
> > cat \<\<-‘EOF’  
> > foo\bar$baz  
> > EOF  
> > =\>  
> > foo\bar$baz

> `cat’ is a shell command. I suppose you meant something like

… Whoops. This is right next to comp.unix.shell in my reading list,  
and  
oddly, the feature appears to be nearly identical. Except for the  
different handling of -‘MARKER’.

-s
