From c4a548ae1ca819fe46a88df2f10a635715d6039c Mon Sep 17 00:00:00 2001 From: Yanbing Date: Mon, 14 Jan 2019 14:04:15 -0800 Subject: [PATCH] Updated Remote command line escaping rules (markdown) --- Command-line-support-for-various-shells.md | 11 +++++++++++ Remote-command-line-escaping-rules.md | 12 ------------ 2 files changed, 11 insertions(+), 12 deletions(-) create mode 100644 Command-line-support-for-various-shells.md delete mode 100644 Remote-command-line-escaping-rules.md diff --git a/Command-line-support-for-various-shells.md b/Command-line-support-for-various-shells.md new file mode 100644 index 0000000..b58403c --- /dev/null +++ b/Command-line-support-for-various-shells.md @@ -0,0 +1,11 @@ +Here are examples to run commands on remote shell over openssh. Examples are to print out "hello" remotely. + +| DefaultShell | cmd on local shell | cmd to print on remote shell (client cmd run in cmd prompt) | +|:--|:--|:--| +| powershell | echo `'"hello"'`
or ``echo `"hello`"`` |`c:\>ssh.exe localhost echo '\"hello\"'`
or ``c:\>ssh.exe winbox echo `\"hello`\"``
or ``c:\>ssh.exe localhost "echo `""hello`"""`` | +| bash | ``echo \"hello\"``
or ``echo '"hello"'``| ``c:\>ssh winbox 'echo \"hello\"'``
or `c:\>ssh.exe winbox echo \\\"hello\\\"`
or `c:\>ssh winbox echo '\"hello\"'` | +| cygwin | ``echo \"hello\"``
or ``echo '"hello"'`` | ``c:\>ssh winbox 'echo \"hello\"'``
or `c:\>ssh.exe winbox echo \\\"hello\\\"`
or `c:\>ssh winbox echo '\"hello\"'` | +| cmd.exe | `echo "hello"` | `c:\>ssh.exe winbox echo \"hello\"`
or `c:\>ssh.exe winbox "echo ""hello"""` | +| ssh-shellhost.exe | to be added | to be added | + +If you have a shell other than above and want it to receive exactly the same argument list that the ssh received on the server side, Please refer to [DefaultShell](https://github.com/PowerShell/Win32-OpenSSH/wiki/DefaultShell) for setting DefaultShell and set DefaultShellEscapeArguments to 0. \ No newline at end of file diff --git a/Remote-command-line-escaping-rules.md b/Remote-command-line-escaping-rules.md deleted file mode 100644 index 1d1fefe..0000000 --- a/Remote-command-line-escaping-rules.md +++ /dev/null @@ -1,12 +0,0 @@ -OpenSSH follow the below rules to determine if the " and \ in shell arguments are escaped or not -Here are examples to print out "hello" on different shells - -| DefaultShell | cmd to print on local shell | cmd to print on remote shell (client cmd run in cmd prompt) | -|:--|:--|:--| -| powershell | ``echo `"hello`"`` |``c:\>ssh.exe winbox echo `\"hello`\"`` | -| bash | ``echo '"hello"'``
or ``echo \"hello\"``| ``c:\>ssh winbox 'echo \"hello\"'``
or `c:\>ssh.exe winbox echo \\\"hello\\\"`
or `c:\>ssh winbox echo '\"hello\"'` | -| cygwin | ``echo '"hello"'``
or ``echo \"hello\"``| ``c:\>ssh winbox 'echo \"hello\"'``
or `c:\>ssh.exe winbox echo \\\"hello\\\"`
or `c:\>ssh winbox echo '\"hello\"'` | -| cmd.exe | `echo "hello"` | `c:\>ssh.exe winbox echo \"hello\"` | -| ssh-shellhost.exe | to be added | to be added | - -Please refer to [DefaultShell](https://github.com/PowerShell/Win32-OpenSSH/wiki/DefaultShell) for setting DefaultShell and DefaultShellEscapeArguments. \ No newline at end of file