claude-code - 💡(How to fix) Fix Skill execution fails when glob pattern contains backticks - shell command substitution bug [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#54222Fetched 2026-04-29 06:33:01
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×4closed ×1

Error Message

Error: Shell command failed for pattern "!`.github/PULL_REQUEST_TEMPLATE/default.md`": [stderr]
.github/PULL_REQUEST_TEMPLATE/default.md: line 2: syntax error near unexpected token `newline'
.github/PULL_REQUEST_TEMPLATE/default.md: line 2: `<!-- Briefly describe what and why you changed -->'

Root Cause

The file path .github/PULL_REQUEST_TEMPLATE/default.md is wrapped in backticks and passed to the shell. Bash interprets the backticks as command substitution, attempting to execute the markdown file as a script. The HTML comment <!-- ... --> in the markdown file then causes a bash syntax error.

Code Example

Error: Shell command failed for pattern "!`.github/PULL_REQUEST_TEMPLATE/default.md`": [stderr]
.github/PULL_REQUEST_TEMPLATE/default.md: line 2: syntax error near unexpected token `newline'
.github/PULL_REQUEST_TEMPLATE/default.md: line 2: `<!-- Briefly describe what and why you changed -->'
RAW_BUFFERClick to expand / collapse

Bug Description

When running a skill (e.g., github-issue-cycle), the execution fails with a shell syntax error because backticks in glob patterns are interpreted as command substitution by bash.

Error Message

Error: Shell command failed for pattern "!`.github/PULL_REQUEST_TEMPLATE/default.md`": [stderr]
.github/PULL_REQUEST_TEMPLATE/default.md: line 2: syntax error near unexpected token `newline'
.github/PULL_REQUEST_TEMPLATE/default.md: line 2: `<!-- Briefly describe what and why you changed -->'

Root Cause

The file path .github/PULL_REQUEST_TEMPLATE/default.md is wrapped in backticks and passed to the shell. Bash interprets the backticks as command substitution, attempting to execute the markdown file as a script. The HTML comment <!-- ... --> in the markdown file then causes a bash syntax error.

Expected Behavior

File paths in glob patterns should be properly escaped before being passed to shell commands. Backticks should not trigger command substitution.

Environment

  • OS: Windows 11
  • Shell: bash (Git Bash)
  • Claude Code version: latest

Steps to Reproduce

  1. Have a file at .github/PULL_REQUEST_TEMPLATE/default.md with HTML comments
  2. Run a skill that uses glob patterns (e.g., github-issue-cycle)
  3. Observe shell command substitution error

Suggested Fix

Escape backticks or use single quotes when passing file paths to shell commands in the skill execution pipeline.

extent analysis

TL;DR

Escape backticks in file paths or use single quotes when passing them to shell commands to prevent command substitution errors.

Guidance

  • Verify that the issue is resolved by checking if the shell command executes without syntax errors after applying the suggested fix.
  • Use single quotes around file paths in glob patterns to prevent bash from interpreting backticks as command substitution.
  • Test the skill execution pipeline with the modified file paths to ensure that the fix works as expected.
  • Consider updating the skill execution pipeline to automatically escape backticks in file paths to prevent similar issues in the future.

Example

# Before
github-issue-cycle "!`.github/PULL_REQUEST_TEMPLATE/default.md`"

# After
github-issue-cycle "'!.github/PULL_REQUEST_TEMPLATE/default.md'"

Notes

The suggested fix assumes that the issue is caused by the interpretation of backticks as command substitution by bash. If the issue persists after applying the fix, further investigation may be necessary to identify the root cause.

Recommendation

Apply the workaround by escaping backticks or using single quotes around file paths in glob patterns, as this is a straightforward and effective solution to prevent command substitution errors.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING