因為我很懶….
叫我一次一次輸入帳密= =”
#!/bin/bash
pass="{PASS}"
export pass
for num in $(seq 21 29)
do
#upload
export num
expect -c '
spawn sudo scp -rv /webmail/log_archive/2013_05/mailerd_2nd.log.1305$env(num)_m2 {USER}@{IP_Address}:/tmp/
expect -re "password:"
exp_send -- "$env(pass)r"
interact
'
expect -c '
spawn sudo scp -rv /webmail/log_archive/2013_05/mailerd_2nd.log.1305$env(num) {USER}@{IP_Address}:/tmp/
expect -re "password:"
exp_send -- "$env(pass)r"
interact
'
expect -c '
spawn sudo scp -rv /webmail/log_archive/2013_05/mailerd.log.1305$env(num)_m2 {USER}@{IP_Address}:/tmp/
expect -re "password:"
exp_send -- "$env(pass)r"
interact
'
expect -c '
spawn sudo scp -rv /webmail/log_archive/2013_05/mailerd.log.1305$env(num) {USER}@{IP_Address}:/tmp/
expect -re "password:"
exp_send -- "$env(pass)r"
interact
'
done