Executing a bash script in python
问题 I've created an expect script that, when executed, ssh's onto a server and executes a series of commands. Pseudocode looks like this: #!/usr/bin/expect spawn ssh usr@myip expect "password:" send "mypassword\n"; send "./mycommand1\r" send "./mycommand2\r" interact When executed from a bash shell ($ ./myscript.txt) the code executes fine. What I would now like to do is have a line in python file that runs the commands in the script the same way the bash shell does. Pseudocode looks like this: