Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 1
    Yeah; the bash is just an interpreter. It follows the rules it is programmed by, so there could be exceptions - like evaluating everything except for given context. This is common in all(or almost all) languages, nothing strange. It just makes sense. Also, bash isn't implemented in bash, so it's not like they had to use magic tricks to make this work. Commented Feb 12, 2016 at 9:07
  • It is absolutely necessary to apply this method for escaping expansion when passing text to a file from a script. This worked properly for me when using "<<END_TEXT" on a string that contained variables within it. Commented Nov 6, 2020 at 20:42
  • 1
    @suprematis: actually that's not necessary; if you quote the delimiter-word or any part of it, like <<'END' or <<'E'ND or <<\END, then no expansions are done in the heredoc body. See gnu.org/software/bash/manual/html_node/… . Commented Feb 20, 2022 at 1:41