Re: pexpect ssh login and ls | grep

2008-01-01 Thread crybaby
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 k

Re: pexpect ssh login and ls | grep

2008-01-01 Thread crybaby
I don't get 0 or 2(excuting ls command exit code) from result.split('\r\n')[0] or result.split('\r\n')[1]. I have to try another method. Regular shell ssh login: [EMAIL PROTECTED] ~]$ ssh [EMAIL PROTECTED] Last login: Mon Dec 31 20:51:09 2007 from com1 [EMAIL PROTECTED] ~]$ Pexpect Login: >>> i

Re: pexpect ssh login and ls | grep

2008-01-01 Thread Dikkie Dik
> shell_cmd = 'ls -l | grep mytest.log' > child = pexpect.spawn ('ssh [EMAIL PROTECTED]') I think you can give the ssh command an option to execute a file remotely. That way, one command would be enough. -- http://mail.python.org/mailman/listinfo/python-list

Re: pexpect ssh login and ls | grep

2008-01-01 Thread Karthik Gurusamy
On Dec 31 2007, 6:46 pm, crybaby <[EMAIL PROTECTED]> wrote: > 1) what are these characters: > \x1b]0; > ~\x07\x1b[?1034h > > in line '\x1b]0;[EMAIL PROTECTED]:[EMAIL PROTECTED] ~]'? These are probably escape sequences in your shell prompt string. Typically they are interpreted by the terminal, lik

Re: pexpect ssh login and ls | grep

2007-12-31 Thread crybaby
1) what are these characters: \x1b]0; ~\x07\x1b[?1034h in line '\x1b]0;[EMAIL PROTECTED]:[EMAIL PROTECTED] ~]'? 2) Also, how come I don't get 0 or 2(excuting ls command exit code) from result.split('\r\n')[0] or result.split('\r\n')[1] ? This is what I get: >>> import pexpect >>> child=pexpect.s

Re: pexpect ssh login and ls | grep

2007-12-31 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, crybaby <[EMAIL PROTECTED]> wrote: >I need to ssh into a remote machine and check if mytest.log file is >there. I have setup ssh keys to handle login authentications. > >How do I determine if mytest.log is there by using Pexpect. What I >have done so far is spawned

pexpect ssh login and ls | grep

2007-12-31 Thread crybaby
I need to ssh into a remote machine and check if mytest.log file is there. I have setup ssh keys to handle login authentications. How do I determine if mytest.log is there by using Pexpect. What I have done so far is spawned a child for ssh. 1) Now what do I do to execute shell_cmd(ls and grep),