Hi
I wonder if you can help me. I am using pexpect with python to access remote
machines and run commands on them. I pass commands into code like so:
def cmd(self, cmd):
pp=[ "|", "]", "[", "(", ")", "$", "?", "*", ".", ":"]
expcmd=cmd
for element in pp:
expcmd=expcmd.replace(element, "\\%s" % element)
self.spawn.setecho(False)
self.spawn.sendline(cmd)
self.spawn.expect (expcmd)
self.spawn.expect(self.prompt)
return self.spawn.before
The above code is supposed to match the command, then match the prompt and
then return what is in between. Since pexpect uses regular expressions to
match what it sees
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20061002/120e2619/attachment.html>