#!/usr/bin/expect spawn rsync -cavze "/usr/local/bin/ssh -p8080" ./data/ --include=*.json user_00@10.6.207.130:/data/web/go/htdocs/search/ expect { "*(yes/no)*" {send "yes/n"; exp_continue;} "*password*" {send "xxx/n";exp_continue;} timeout { exec kill -9 [exp_pid]; close; } }