Open InPermutation opened 10 years ago
try 'whoami && whoami' and from cmd.exe to see if it works, then follow up with powershell. I don't expect it to work at all in a bash shell since it has been stripping all single and double quotes. Note the docs did change to say to stop using double quotes and to just use single quotes as double quotes don't work very well in powershell.
On Wednesday, November 27, 2013, Jacob Krall wrote:
b11af99https://github.com/chocolatey/chocolatey/commit/b11af99077a19a54ab006d82eebeea06d0ea76d4breaks any strings containing the character &:
PS> plink -pw vagrant vagrant@192.168.137.193 <javascript:_e({}, 'cvml', 'vagrant@192.168.137.193');> "whoami && whoami"vagrantporos\jacob
Note that whoami ran on the remote host once, and on the local machine once, because the string "whoami && whoami" is not making it all the way to plink.
— Reply to this email directly or view it on GitHubhttps://github.com/chocolatey/chocolatey/issues/385 .
Rob "Be passionate in all you do"
http://devlicio.us/blogs/rob_reynolds http://ferventcoder.com http://twitter.com/ferventcoder
PS> plink -pw vagrant vagrant@192.168.137.193 'whoami && whoami'
vagrant
poros\jacob
Same results, because the strings "whoami && whoami"
and 'whoami && whoami'
are identical in PowerShell. I'm not sure what "double quotes don't work very well in powershell" means - they work exactly as they were designed.
Apologies, I did ask what would happen in the call from cmd.exe trying to isolate whether this is a powershell issue with the batch redirects or not.
Powershell tends to strip off double quotes from calls, I've got about 10+ hours testing this recently. Most calls were related to calling choco but the stripping was already done by the time it hit the batch redirect.
With single quotes I was not seeing this behavior. Perhaps this is related to the environment I was testing this in, but there are some articles out there that talk about how powershell does interesting stuff with quotes in general and how you should use ` in front of them in calls to things so that they are used literally and not stripped off.
On Wednesday, November 27, 2013, Jacob Krall wrote:
plink -pw vagrant vagrant@192.168.137.193 <javascript:_e({}, 'cvml', 'vagrant@192.168.137.193');> 'whoami && whoami'vagrantporos\jacob
Same results, because the strings "whoami && whoami" and 'whoami && whoami' are identical in PowerShell. I'm not sure what "double quotes don't work very well in powershell" means - they work exactly as they were designed.
— Reply to this email directly or view it on GitHubhttps://github.com/chocolatey/chocolatey/issues/385#issuecomment-29424953 .
Rob "Be passionate in all you do"
http://devlicio.us/blogs/rob_reynolds http://ferventcoder.com http://twitter.com/ferventcoder
Also the next version deprecates the batch redirects in favor of shim exes for better cross shell support.
On Wednesday, November 27, 2013, Rob Reynolds wrote:
Apologies, I did ask what would happen in the call from cmd.exe trying to isolate whether this is a powershell issue with the batch redirects or not.
Powershell tends to strip off double quotes from calls, I've got about 10+ hours testing this recently. Most calls were related to calling choco but the stripping was already done by the time it hit the batch redirect.
With single quotes I was not seeing this behavior. Perhaps this is related to the environment I was testing this in, but there are some articles out there that talk about how powershell does interesting stuff with quotes in general and how you should use ` in front of them in calls to things so that they are used literally and not stripped off.
On Wednesday, November 27, 2013, Jacob Krall wrote:
plink -pw vagrant vagrant@192.168.137.193 'whoami && whoami'vagrantporos\jacob
Same results, because the strings "whoami && whoami" and 'whoami && whoami' are identical in PowerShell. I'm not sure what "double quotes don't work very well in powershell" means - they work exactly as they were designed.
— Reply to this email directly or view it on GitHubhttps://github.com/chocolatey/chocolatey/issues/385#issuecomment-29424953 .
Rob "Be passionate in all you do"
http://devlicio.us/blogs/rob_reynolds http://ferventcoder.com http://twitter.com/ferventcoder
Rob "Be passionate in all you do"
http://devlicio.us/blogs/rob_reynolds http://ferventcoder.com http://twitter.com/ferventcoder
not sure if it helps you guys, but to get an effective && if powershell you would need
whoami ; if($?) {whoami}
@rismoney that is the opposite of the problem we are having - we want to run whoami inside the SSH session, not PowerShell.
@ferventcoder should I just wait for the shim exes, then?
It will be out this week. Just finishing up the cleanup of the batch redirects during update...
@ferventcoder Looking forward to it. Thanks.
b11af99077a19a54ab006d82eebeea06d0ea76d4 breaks any strings containing the character
&
:Note that
whoami
ran on the remote host once, and on the local machine once, because the string"whoami && whoami"
is not making it all the way toplink
.