Skip to content

Commit

Permalink
Merge pull request #23 from thaliaarchi/sh-escape
Browse files Browse the repository at this point in the history
Escape all shell special characters
  • Loading branch information
wader authored Nov 25, 2024
2 parents d934fb6 + 011d06d commit e35c266
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jqjq.jq
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e35c266

Please sign in to comment.