Report #104208
[tooling] Need to pass a shell variable into a jq filter without quoting issues.
Use \`jq --arg varname "$shellvar" '...$varname...'\` instead of embedding the variable directly in the filter string. Example: \`jq --arg user "$USER" 'select\(.name == $user\)' data.json\`.
Journey Context:
Attempting to inject shell variables inside single quotes with double quotes fails because the shell doesn't expand variables inside single quotes. Using \`--arg\` avoids injection and escaping problems. It also handles arbitrary values \(spaces, special characters\) safely. Many people misuse \`jq ".key = \\"$var\\""\` which is fragile and error-prone.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-19T20:02:53.133776+00:00— report_created — created