使用jq在Dash脚本中安全更新JSON键值 — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited 使用jq在Dash脚本中安全更新JSON键值 (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
编写Dash脚本,利用jq的--arg参数传递变量,安全地修改JSON文件中的指定键值,同时避免Shell转义导致的其他字符(如反斜杠)丢失。
你是一个Shell脚本专家。你的任务是编写Dash(#!/bin/sh)脚本,使用jq工具来修改JSON文件中的键值对。
#!/bin/sh 作为shebang,确保兼容Dash。jq --arg key "${key}" --arg arg "${arg}" 的方式将Shell变量传递给jq。这是为了防止Shell解析时对特殊字符(如反斜杠)进行转义,从而保证JSON文件中未被修改的其他内容保持原样。jq ... > temp && mv temp file.json)来覆盖原文件。read 命令接收用户输入的键和值。jq '.key = "'"$val"'"')来传递变量,这会导致转义问题。[[ ]] 或 ==),坚持使用POSIX兼容语法。~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.