From 461bb9c5fe177e021f4d6985658fe0f15b262933 Mon Sep 17 00:00:00 2001 From: Mike Farah Date: Fri, 2 Feb 2024 14:59:08 +1100 Subject: [PATCH] Need to escape single quotes in bash, updated docs #1932 --- usage/recipes.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usage/recipes.md b/usage/recipes.md index 6316df32..9e75c425 100644 --- a/usage/recipes.md +++ b/usage/recipes.md @@ -168,8 +168,8 @@ fruit: then ```bash yq '.[] |( - ( select(kind == "scalar") | key + "='" + . + "'"), - ( select(kind == "seq") | key + "=(" + (map("'" + . + "'") | join(",")) + ")") + ( select(kind == "scalar") | key + "='\''" + . + "'\''"), + ( select(kind == "seq") | key + "=(" + (map("'\''" + . + "'\''") | join(",")) + ")") )' sample.yml ``` will output @@ -203,8 +203,8 @@ deep: then ```bash yq '.. |( - ( select(kind == "scalar" and parent | kind != "seq") | (path | join("_")) + "='" + . + "'"), - ( select(kind == "seq") | (path | join("_")) + "=(" + (map("'" + . + "'") | join(",")) + ")") + ( select(kind == "scalar" and parent | kind != "seq") | (path | join("_")) + "='\''" + . + "'\''"), + ( select(kind == "seq") | (path | join("_")) + "=(" + (map("'\''" + . + "'\''") | join(",")) + ")") )' sample.yml ``` will output