diff options
author | Jasper Ras <jras@hostnet.nl> | 2025-08-21 22:09:29 +0200 |
---|---|---|
committer | Jasper Ras <jras@hostnet.nl> | 2025-08-21 22:09:29 +0200 |
commit | 27514d58573ce1f844af4ea60afa72c7f58f1cd7 (patch) | |
tree | 4b16c31f73cb72435d03d5e105261143f8ca135f /Heredoc struggles.md | |
parent | 22675cd8dc75d8b8d4b0f818f5b093efbc364802 (diff) |
Diffstat (limited to 'Heredoc struggles.md')
-rw-r--r-- | Heredoc struggles.md | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Heredoc struggles.md b/Heredoc struggles.md new file mode 100644 index 0000000..076b248 --- /dev/null +++ b/Heredoc struggles.md @@ -0,0 +1,21 @@ +```puppet +@(END) <- no str interpolation +@("END") <- quotes around END enable string interpolation ${} +@("END"/$) <- interpolation + we can escape from it using \$ for a literal $ +END + | END + +``` + +#### Escape sequences + +|Switch to put in the heredoc tag|Escape sequence to use in the heredoc string|Result in the string value| +|---|---|---| +|(automatic)|`\\`|Single backslash. This switch is enabled when any other escape sequence is enabled.| +|`n`|`\n`|New line| +|`r`|`\r`|Carriage return| +|`t`|`\t`|Tab| +|`s`|`\s`|Space| +|`$`|`\$`|Literal dollar sign (to prevent interpolation)| +|`u`|`\uXXXX` or `\u{XXXXXX}`|Unicode character number `XXXX` (a four-digit hexadecimal number) or `XXXXXX` (a two- to six-digit hexadecimal number)| +|`L`|`\<New line or carriage return>`|Nothing. This lets you put line breaks in the heredoc source code that does not appear in the string value.
\ No newline at end of file |