OK so I have this line,
$ssh->exec('cd E:\\Titan\ Torque\\Jobs');
Now how to I use this with the double slashes? I mean I need 2 slashes to be sent not one the command:
cd E:\\Titan\ Torque\\Jobs
Is what I need to be executed.
PS The ssh server is running on windows, this command runs fine in putty but PHP is stripping it down to:
cd E:\Titan\ Torque\Jobs
Any help would be appreciated.
I think if you escape the backslashes with backslashes, they should work.
$ssh->exec('cd E:\\\\Titan\\ Torque\\\\Jobs');
In a test:
echo 'E\\:a thing with\slashes\\';
echo "\n";
echo 'E\\\\:a thing with\\\\slashes\\';
gives
E\:a thing with\slashes\
E\\:a thing with\\slashes\
In case you're curious, the reason a single backslash works at all, is because \\
isn't a special escape sequence so it's put into the resultant string literally.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.