Feature Request: Configurable shell for command execution
Problem
On Windows, ECA automatically defaults to PowerShell for all shell command execution. For users running MSYS2/UCRT64 (or similar MinGW-based environments), this creates a significant friction point: every command must be manually wrapped in bash -c "..." via system prompt instructions to the LLM.
While this workaround generally works, it introduces persistent quoting and escaping issues. Nested quotes, special characters, heredocs, and complex multi-line commands frequently break because the LLM has to produce a valid PowerShell string that contains a valid Bash string — two layers of escaping that are error-prone and hard to reason about, even for advanced models.
Examples of recurring issues:
- Python
-ccommands with mixed single/double quotes fail due to double escaping - Heredocs (
<<'EOF') don't work reliably when wrapped inbash -c "..." git commit -mwith multi-line messages and special characters becomes a minefield- f-strings and template literals with braces get mangled by the extra shell layer
Proposed Solution
Allow users to configure the shell executable in config.json (or the relevant ECA configuration file), e.g.:
{
"shell": {
"path": "C:/msys64/ucrt64/bin/bash.exe",
"args": ["-l", "-c"]
}
}
or a simpler variant:
{
"shell": "C:/msys64/ucrt64/bin/bash.exe"
}
This way, ECA would spawn the configured shell directly instead of PowerShell, eliminating the extra wrapping layer entirely. Commands generated by the LLM would be Bash commands executed natively — no double escaping, no quoting gymnastics.
Benefits
- Eliminates an entire class of quoting/escaping bugs that currently plague Windows+MSYS2 users
- Simplifies system prompts — no need for lengthy rules explaining the
bash -cworkaround - Reduces token waste — the LLM no longer needs to generate wrapper boilerplate for every single command
- Improves reliability — commands work the same way they would in a native terminal
- Low implementation cost — this is essentially just making the shell spawn target configurable instead of hardcoded
Environment
- Windows 11 with MSYS2/UCRT64
- Emacs as editor (but this affects any Windows user with a non-PowerShell shell preference)
Additional Context
The current workaround requires a dedicated section in the system prompt (rules) instructing the LLM to always prefix commands with bash -c "...". This works ~60% of the time but fails unpredictably on complex commands, leading to frustrating(LLMs) debugging sessions where the actual task is correct but the shell wrapping breaks it.
Example:
Running 'bash -c "wc -l 'd:/Progra...' ✅ 0s
Running 'bash -c "awk '
Track us...' ❌ 0s
Running 'bash -c 'awk '"'"'
Trac...' ❌ 0s
Running 'bash -c 'cat > /tmp/scan_...' ❌ 0s
Let me use a different approach: Running 'bash -c "python3 -c ' imp...' ❌ 0s
Running 'bash -c 'python3 << '"'"'...' ❌ 0s
Running 'bash -c 'cat > /tmp/scan_...' ✅ 0s
Empty output – the heredoc was probably not written correctly. Trying with a Python script directly. Running 'bash -c "cat > /tmp/scan_...' ❌ 0s
The problem is the shell quoting hell. I'll write the script via Python itself: Running 'bash -c 'python3 -c " imp...' ❌ 0s
Running 'bash -c 'echo "import re,...' ❌ 0s
Running 'bash -c 'printf "%s\n" "i...' ✅ 0s
This is getting too complex with the shell quoting situation. Let me use a clean approach with a file instead: Running 'bash -c 'python3 -c "
That's fair! was not aware of those issues, but makes sense
I tried it by patching hard shell.clj and it works like a charm absolute benefit for windows users (unintentionally)
So maybe some more give thumb up :-)
Cool! Will work on this soon!
Done @snoopier! should be available on next release
Very nice we're using it with system prompt like
TOOLS & ENVIRONMENT CONSTRAINTS
Shell Environment
- Platform: Windows with MSYS2/ucrt64
- Shell: ECA executes all commands via
bash -cautomatically — write plain Bash commands directly - Path Handling: Use forward slashes
/; preferd:/d:/Temp/Teststyle paths - Line Endings: Be aware of CRLF vs LF issues; use
dos2unixif needed
Command Execution Pattern
# Write plain Bash commands — ECA wraps them in bash -c automatically:
python -m venv .venv && source .venv/bin/activate && pip install requests
find d:/Projects -name '*.py'
source .venv/bin/activate && python script.py
echo 'Hello World'
python -c 'import requests; print(requests.__version__)'
Tips:
- Write commands as you would in a normal Bash terminal
- Use
&∨to chain multiple commands - Use single quotes
'...'for inline code (e.g.,python -c '...') - If quoting becomes complex, split into multiple tool calls
Python
- REQUIRED: Always use virtual environments (
venv), except for one-off scripts without dependencies. - Activation:
source .venv/bin/activate(ucrt64/bash) or.venv/Scripts/activate(Git Bash) - Deactivation:
deactivate - Package Management:
pipwithin venv; never install globally - Version: Verify with
python --versionbefore assuming features
Tool Preferences
| Task | Preferred | Avoid |
|---|---|---|
| Shell commands | bash |
powershell, cmd |
| File search | find, fd |
Windows dir |
| Text search | grep, ripgrep (rg) |
findstr |
| JSON processing | python |
manual parsing |
| HTTP requests | curl |
Invoke-WebRequest |
Command Examples
# Plain Bash commands — no wrapper needed:
# Create and activate venv
python -m venv .venv && source .venv/bin/activate
# Run Python script in venv
source .venv/bin/activate && python script.py
# Install packages
source .venv/bin/activate && pip install requests pandas
# Path handling (forward slashes work in bash)
cat d:/Projects/myfile.txt
# Find files
find d:/Projects -name '*.py' -type f
# Multiple commands
cd d:/Projects && ls -la && python --version
Maybe other users are interested in...