From 011d06d8feecf25e6857760becb9d34ea11d36f9 Mon Sep 17 00:00:00 2001 From: Thalia Archibald Date: Mon, 25 Nov 2024 11:28:14 -0800 Subject: [PATCH] Escape all shell special characters --- jqjq.jq | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jqjq.jq b/jqjq.jq index 057187d..4b96ff1 100644 --- a/jqjq.jq +++ b/jqjq.jq @@ -2735,9 +2735,9 @@ def parse_options: ); def invoke_client_jqjq: - # instead of @sh to not always quote + # instead of @sh to not always quote (as per quoting rules of ${var@Q}) def sh_escape: - if . == "" or test("['\" $\n\\\\()]") then + if . == "" or test("[^[A-Za-z0-9%+\\-./:=@_]]") then "'" + gsub("'"; "'\\''") + "'" end; ( . as $args