From 3e0da390ee002b0482e34b722756a844752a50fd Mon Sep 17 00:00:00 2001 From: Mike Farah Date: Sun, 5 Dec 2021 12:15:19 +1100 Subject: [PATCH] better troubleshooting --- usage/tips-and-tricks.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usage/tips-and-tricks.md b/usage/tips-and-tricks.md index f9eb4e37..d1c7d2b0 100644 --- a/usage/tips-and-tricks.md +++ b/usage/tips-and-tricks.md @@ -50,6 +50,9 @@ Use an environment variable with the `strenv` operator to inject the contents fr LICENSE=$(cat LICENSE) yq eval -n '.a = strenv(LICENSE)' ``` +Note that `bash` substitution "$(..)" trims newlines, this will cause string blocks to start with `|-` instead of `|`. If you want to keep your nice trailing newline, read more [here](https://mikefarah.gitbook.io/yq/operators/string-operators#string-blocks-bash-and-newlines) + + ## Special characters in strings The `strenv` operator is a great way to handle special characters in strings: