Reputation: 60
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?
Upvotes: 0
Views: 599
Reputation: 2818
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
Upvotes: 2