I connected to remote system using Python Pexpect, Now I want to execute some script(available on remote machine) on remote system is it possible?
            Asked
            
        
        
            Active
            
        
            Viewed 584 times
        
    1 Answers
2
            Yes, 
you can do it by adding \n between the commands
Or,
child = pexpect.spawn('ssh MACHINE')
child.sendline('command1')
child.sendline('command2')
child.sendline('command3')
child.close()
I would advice you reading this http://pexpect.readthedocs.io/en/stable/overview.html
 
    
    
        Yonatan Kiron
        
- 2,718
- 1
- 20
- 25
