Yuri
2020-Jan-11 17:03 UTC
Why are the arguments supplied for the command run through ssh interpreted by shell before they are passed to the command on the server side?
On 2020-01-11 08:57, Thorsten Glaser wrote:> If you wish for no local expansion, quote locally, such as: > > ssh -l luser remotehost ' > command1 > command2 > ? > 'This didn't work for me because single quotes only prevent local expansion. The string is expanded on the remote host. Yuri
Thorsten Glaser
2020-Jan-11 17:07 UTC
Why are the arguments supplied for the command run through ssh interpreted by shell before they are passed to the command on the server side?
On Sat, 11 Jan 2020, Yuri wrote:> On 2020-01-11 08:57, Thorsten Glaser wrote: > > If you wish for no local expansion, quote locally, such as: > > > > ssh -l luser remotehost ' > > command1 > > command2 > > ? > > '> This didn't work for me because single quotes only prevent local expansion.Then you didn?t do it right.> The string is expanded on the remote host.Yes, ?command1? is expanded remotely, but you use the quoting rules of the remote shell INSIDE the single quotes for the local POSIX shell to prevent that (just replace all ' with '\'' and you?re set). bye, //mirabilos -- tarent solutions GmbH Rochusstra?e 2-4, D-53123 Bonn ? http://www.tarent.de/ Tel: +49 228 54881-393 ? Fax: +49 228 54881-235 HRB 5168 (AG Bonn) ? USt-ID (VAT): DE122264941 Gesch?ftsf?hrer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg
Yuri
2020-Jan-11 17:13 UTC
Why are the arguments supplied for the command run through ssh interpreted by shell before they are passed to the command on the server side?
On 2020-01-11 09:07, Thorsten Glaser wrote:> Yes, ?command1? is expanded remotely, but you use the quoting rules > of the remote shell INSIDE the single quotes for the local POSIX shell > to prevent that (just replace all ' with '\'' and you?re set).It arrives to the remote host with the outer quotes stripped, and the expansion takes place. Perhaps this would work '\'some command\''. Then there should be double-quoting of any single-quote characters inside. Yuri