I think you're mistaken about how 'sh -c' works. The next argument after "-c"
is
the script, and following arguments are the positional arguments. (what, you've
never used -c in conjunction with positional arguments? me either!)
Example:
-
I can't seem to get that to work either.
child =
pexpect.spawn('/bin/sh',args=['-c','/usr/bin/ssh','-t','-o','StrictHostKeyChecking
no',host,command,'|','awk','{print %s:$0}'%host], timeout=30)
Complains its getting the wrong arguments to ssh.
Eli
--
http://mail.python.org/mailman/listinfo/pyt
Eli Criffield wrote:
> I'm try run an ssh command in pexpect and I'm having trouble getting
> everything escaped to do what i want.
>
> Here's a striped down script showing what i want to do.
>
> --
> #!/usr/bin/env python
> import pexpect
> import sys
> if len(sys.argv) < 3:
> print "ssh