shell 脚本如下 这个scp脚本是成功的 然后我现在想要在scp执行完以后执行自动启动jar包
#!/bin/expect
set timeout 300
spawn scp -r /root/.jenkins/workspace/adfinal/store/target/store-0.0.1-SNAPSHOT.jar root@120.78.204.195:/root/test
expect {
-re "password:" {send "Wztisroot\r"}
}
interact
这是第二次修改的脚本
#!/bin/expect
set timeout 300
spawn scp -r /root/.jenkins/workspace/adfinal/store/target/store-0.0.1-SNAPSHOT.jar root@120.78.204.195:/root/test
expect {
-re "password:" {send "Wztisroot@2018\r"}
}
spawn ssh root@120.78.204.195 -t "cd /root/test;java -jar /root/test/store-0.0.1-SNAPSHOT.jar;bash --login"
expect {
"(yes/no)?"
{send "yes\n";exp_continue}
"password:"
{send "Wztisroot@2018\n"}
}
interact
但是执行以后发现还没有等传输完成它就已经知道启动这一步了,请问这个要怎么判断scp是否传输完成?