我正在尝试指示我的Python安装执行Expect脚本"myexpect.sh":
#!/usr/bin/expect
spawn ssh usr@myip
expect "password:"
send "mypassword\n";
send "./mycommand1\r"
send "./mycommand2\r"
interact
Run Code Online (Sandbox Code Playgroud)
我在Windows上,所以将Expect脚本中的行重写为Python不是一种选择.有什么建议?有没有什么可以像"./myexpect.sh"从bash shell那样运行它?
我在subprocess命令上取得了一些成功:
subprocess.call("myexpect.sh", shell=True)
Run Code Online (Sandbox Code Playgroud)
我收到错误:
myexpect.sh不是有效的Win32应用程序.
我该如何解决这个问题?