Hi.
I'm using a simple pexpect script to ssh to a remote machine and grab a value returned by a command. Is there any way, pexpect or sshwise I can use to ignore the unix greeting? That is, from
child = pexpect.spawn('/usr/bin/ssh %s@%s' % (rem_user, host))
child.expect('[pP]assword: ', timeout=5)
child.sendline(spass)
child.expect([pexpect.TIMEOUT, prompt])
child.before = '0'
child.sendline ('%s' % cmd2exec)
child.expect([pexpect.EOF, prompt])
# Collected data processing
result = child.before
# logon to the machine returns a lot of garbage, the returned executed command is at the 57th position
print result.split('\r\n') [57]
result = result.split('\r\n') [57]
How can I simply get the returned value, ignoring, the "Last successful login" and "(c)Copyright" stuff and without having to concern with the value correct position?
Thanks !