ConEmu
ConEmu copied to clipboard
Issue with argument string ending with `\`
Versions
ConEmu build: 210912 x32/x64 OS version: Windows 10 x64 Used shell version: Clink 1.1.45.1c3985
Problem description
When an argument string ends with \, and it is wrapped between " (this happens by default for paths containing spaces in Windows), it is passed as a string ending with ".
Steps to reproduce
- Write a bash script which prints all input arguments with command
echo $@ - Run it passing a Windows path with spaces, for instance:
bash script.sh "c:\test\path with spaces\"
Actual results
Output is c:\test\path with spaces"
Expected results
Output should be c:\test\path with spaces
You have quite an obsolete version. Have you tried newer builds?
That's the stable version included by default in Cmder. I now tried with the preview version 220418, and then with the latest alpha version 220807, and they all behave the same.
This is not a ConEmu or Cmder issue. This is part of Windows.
You are running bash script.sh "c:\test\path with spaces\" on Windows from a CMD shell. The bash is actually bash.exe which is a Windows wrapper program that starts the WSL and then runs the actual Linux bash.
On Windows, \" is an escaped quote.
See these articles for more information:
- https://docs.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-commandlinetoargvw?redirectedfrom=MSDN
- https://docs.microsoft.com/en-us/archive/blogs/twistylittlepassagesallalike/everyone-quotes-command-line-arguments-the-wrong-way
To get the same command line processing as Linux, you would need to first start WSL explicitly, and then run bash from inside the Linux subsystem.
Ok thanks, I'm closing this issue