| 12345678910111213141516171819202122 |
- #!/bin/bash
- Ip="was.baoshi56.com"
- username="haozi"
- password="haozi"
- update_path=/var/www/update
- dsc=/var/www/update
- # shellcheck disable=SC2045
- # shellcheck disable=SC2034
- # shellcheck disable=SC2006
- for file in `ls $update_path`
- do
- expect -c "
- spawn scp -P 10022 -r $update_path/$file $username@$Ip:$dsc
- expect {
- \"*assword\" {set timeout 120; send \"$password\r\";}
- \"yes/no\" {send \"yes\r\"; exp_continue;}
- }
- expect eof"
- done
|