From: Iñaki Baz Castillo on 29 Dec 2009 19:38 Hi, the following code ---------------------- banner = <<-EOF /\/ EOF puts banner ---------------------- produces: ---------------------- // ---------------------- How could I avoid the "\" scaping so the text appears verbatim? Thanks a lot. -- Iñaki Baz Castillo <ibc(a)aliax.net>
From: Seebs on 29 Dec 2009 20:06 On 2009-12-30, I�aki Baz Castillo <ibc(a)aliax.net> 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 -- Copyright 2009, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
From: Bertram Scharpf on 30 Dec 2009 13:25 Hi, Am Mittwoch, 30. Dez 2009, 10:10:05 +0900 schrieb Seebs: > On 2009-12-30, Iñaki Baz Castillo <ibc(a)aliax.net> 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 `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 -- Bertram Scharpf Stuttgart, Deutschland/Germany * Discover String#notempty? at <http://raa.ruby-lang.org/project/step>.
From: Seebs on 30 Dec 2009 17:06 On 2009-12-30, Bertram Scharpf <lists(a)bertram-scharpf.de> 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 -- Copyright 2009, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
|
Pages: 1 Prev: Ruby Float out of range warning? Next: How to pass a function as parameter? |