From 27514d58573ce1f844af4ea60afa72c7f58f1cd7 Mon Sep 17 00:00:00 2001 From: Jasper Ras Date: Thu, 21 Aug 2025 22:09:29 +0200 Subject: vault backup: 2025-08-21 22:09:29 --- Heredoc struggles.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Heredoc struggles.md (limited to 'Heredoc struggles.md') 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`|`\`|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 -- cgit v1.2.3