What problem does it solve?
The Bash tool can struggle with complex syntax like parameter expansion (${VAR##pattern}) or nested command substitutions, leading to cryptic parse errors. This Skill provides a reliable workaround by converting such commands into temporary script files, ensuring smooth execution.
Core Features & Use Cases
- Parse Error Prevention: Eliminates common Bash tool parse errors by encapsulating complex commands in a script.
- Pattern Recognition: Identifies problematic bash patterns, including parameter expansion with pattern removal, complex
jq pipelines, and multiple nested expansions.
- Automated Conversion: Automatically converts a problematic command into a
cat > /tmp/script.sh << 'EOF' ... EOF; bash /tmp/script.sh structure.
- Error Handling: Provides templates for scripts with
set -euo pipefail and trap for robust execution.
- Use Case: If you encounter a
(eval):1: parse error near '(' when trying to extract an agent ID using a complex jq pipeline and parameter expansion, use this Skill to convert the command into a temporary script, allowing it to execute successfully without manual debugging.
Quick Start
If a bash command fails with a parse error, use this skill:
Skill: bash-to-script
Command: |
SESSION_ID="abc-123"
AGENT_ID=$(jq -r 'select(.toolUseResult.agentId)' /path/${SESSION_ID}.jsonl | tail -1)
echo "$AGENT_ID" > output.txt