Preserving argument splitting with SSH

Lee Eakin leakin at japh.itg.ti.com
Fri Dec 15 14:21:12 EST 2000


The arg splitting is not preserved because it is parsed once by the local
shell, and then again by the shell on the remote system.  When the remote
system's shell sees it the quotes are already gone.

Try this:
    ssh gellar args foo bar \'baz bong\'
or:
    ssh gellar args foo bar "'baz bong'"
 
 I think you'll see it parses properly then.
   -Lee

---begin quoted text---
> Delivered-To: openssh-unix-dev-list-93873 at mindrot.org
> To: openssh-unix-dev at mindrot.org
> Subject: Preserving argument splitting with SSH
> From: Greg Badros <gjb at cs.washington.edu>
> Date: 14 Dec 2000 19:11:56 -0800
> X-Mailer: Gnus v5.6.45/XEmacs 20.4 - "Emerald"
> 
> I'm using:
> 
> % ssh -V
> SSH Version OpenSSH-1.2.3, protocol version 1.5.
> Compiled with SSL.
> % uname -a
> Linux gellar 2.2.13 #1 SMP Wed Dec 29 14:07:41 PST 1999 i686 unknown
> 
> and am wondering whether it's a fundamental shortcoming of the SSH
> protocol that argument splitting is not preserved from client to server, 
> but instead the argument list is re-split on whitespace.  E.g., from my
> machine `gellar', I execute:
> 
> % ssh gellar args foo bar 'baz bong'
> ARG0 = /usr/home/gregb/bin/share/args, NumArgs = 4
> 1 = "foo"
> 2 = "bar"
> 3 = "baz"
> 4 = "bong"
> 
> (where args is just a script that outputs the arguments), instead of
> what I get when I run args directly:
> 
> % args foo bar 'baz bong'       
> ARG0 = /usr/home/gregb/bin/share/args, NumArgs = 3
> 1 = "foo"
> 2 = "bar"
> 3 = "baz bong"
> 
> which is much better.  If it's not a limitation of the protocol, then it 
> should be a pretty easy (and valuable!) fix.
> 
> Please include me in replies as I'm not on the list.
> 
> Thanks,
> Greg
---end quoted text---

-- 
    Lee Eakin - leakin at ti.com - Naming Services, Texas Instruments   -o)
                [ permanent e-mail: Lee at Eakin.Org ]                  /\\
                                                                    _\_v
Allen's Axiom:
  When all else fails, follow instructions.





More information about the openssh-unix-dev mailing list