1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| #!/home/chenzhiheng18/installed/bin/expect
set port [lindex $argv 0] set user_ip [lindex $argv 1] set src_file [lindex $argv 2] set snapshot [lindex $argv 3] set dataset [lindex $argv 4]
set timeout -1 # 打印信息 spawn echo "src_file: $src_file" spawn echo "snapshot: $snapshot" spawn echo "dataset: $dataset"
# 执行scp spawn scp -P $port -r $user_ip:$src_file ./snapshot/ expect { "(yes/no)?" { send "yes\n" expect "*assword:" { send "chen_gpu\n" # 如果不存在,则直接结束当前bash expect "No such file or directory" { exit } # 执行测试 spawn python -u ../../tools/test.py --snapshot $snapshot --dataset $dataset --config config.yaml } } "*assword:" { send "chen_gpu\n" # 如果不存在,则直接结束当前bash expect "No such file or directory" { exit } # 执行测试 spawn python -u ../../tools/test.py --snapshot $snapshot --dataset $dataset --config config.yaml
} }
expect eof
|