-
Notifications
You must be signed in to change notification settings - Fork 844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quoting pipe commands with wsl.exe #3284
Comments
|
+1 clever You can also do:
|
Maybe The document mentions
which doesnt look like the case. Also,
@therealkenc |
Can't vouch for the documentation. Looking at the page you cite they seem to mean by 'piping' in the context of
I can't say if that example ever worked; it might have, I literally can't say and wouldn't deign to try an old version to find out. [edit] It appears to, in 18980, anyway. Still.... Whether it did or it didn't (it did), well formed command is:
Windows CLI arguments don't work like Unix CLI arguments; never have and never will. To pretend they do is a mugs game. YRMV. |
When you using powershell, escape character is ` instead of ^. |
If you wanna save the ouput to a variable you have to again reuse ^ for the 2 characters ^| :
|
Windows build number:
10.0.17134.81
I'm not quite sure how to feed linux commands using pipes into wsl.exe
Example:
wsl.exe echo test | wc
wsl.exe "echo test | wc"
wsl.exe 'echo test | wc'
all fail, whereas
ubuntu.exe run "echo test | wc"
produces the desired output
1 1 5
.There is a comment in this issue trying to clear it up.
It claims that
wsl.exe <cmd>
internally calls["/bin/bash", "-c", <cmd>]
,but
wsl /bin/bash -c "echo test | wc"
produces correct output whereas the commands above do not.I also tried escaping the double quotes without success.
The text was updated successfully, but these errors were encountered: