I did try to excute the ssh and shell ls grep command in all in one like so:
ssh [EMAIL PROTECTED] "ls mytest.log > /dev/null 2>&1; echo $?" This seem to work, but also throwing exceptions. Also, including ssh and shell command together would be a problem when I later add a pass phrase to ssh key. Can someone provide little insight on this? >>> import pexpect >>> child=pexpect.spawn('ssh [EMAIL PROTECTED] "ls mytest.log > /dev/null >>> 2>&1; echo $?"') >>> >>> child.expect([pexpect.TIMEOUT, '\$']) Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/lib/python2.4/site-packages/pexpect.py", line 1064, in expect return self.expect_list(compiled_pattern_list, timeout, searchwindowsize) File "/usr/lib/python2.4/site-packages/pexpect.py", line 1132, in expect_list raise EOF (str(e) + '\n' + str(self)) pexpect.EOF: End Of File (EOF) in read_nonblocking(). Exception style platform. <pexpect.spawn object at 0xb7ea92ac> version: 2.1 ($Revision: 395 $) command: /usr/bin/ssh args: ['/usr/bin/ssh', '[EMAIL PROTECTED]', 'ls mytest.log > /dev/null 2>&1; echo $?'] patterns: pexpect.TIMEOUT \$ buffer (last 100 chars): before (last 100 chars): 0 after: pexpect.EOF match: None match_index: None exitstatus: 0 flag_eof: True pid: 3524 child_fd: 3 closed: False timeout: 30 delimiter: pexpect.EOF logfile: None maxread: 2000 ignorecase: False searchwindowsize: None delaybeforesend: 0.1 delayafterclose: 0.1 delayafterterminate: 0.1 >>> >>> result=child.before >>> result2=child.after >>> print result 0 >>> print result2 pexpect.EOF -- http://mail.python.org/mailman/listinfo/python-list