Skip to content

Instantly share code, notes, and snippets.

@shalomb
Last active September 24, 2025 07:24
Show Gist options
  • Save shalomb/92a2f3a3097bb9b0e0f26aef7aaac6a8 to your computer and use it in GitHub Desktop.
Save shalomb/92a2f3a3097bb9b0e0f26aef7aaac6a8 to your computer and use it in GitHub Desktop.
cursor-agent shell eval bugfix
# Cursor Agent Bash Initialization Patch
# Adds `G8n+` prefix to bash command execution to ensure proper bash initialization before running commands,
# fixing potential shell state issues.
# Cursor Agent Bash Fix
```bash
#!/bin/bash
set -e
# Check directory
if [ ! -f "index.js" ] || [ ! -f "index.js.bak" ]; then
echo "Error: Run from cursor-agent directory"
exit 1
fi
# Backup
cp index.js index.js.original
# Apply patch
sed -i 's/let s=\["-O","extglob","-c",`snap=/let s=["-O","extglob","-c",G8n+`snap=/' index.js
# Verify
if grep -q 'G8n+`snap=' index.js; then
echo "Patch applied"
else
echo "Patch failed"
exit 1
fi
```
Usage: `cd /path/to/cursor-agent && ./script.sh`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment