Eu tenho o seguinte:
while read line; do
userinfo=$(echo $line | sed 's/@/,/')
IFS=',' read -a address <<< "$userinfo"
userid="${address[0]}"
domain="${address[1]}"
fname="${address[2]}"
lname="${address[3]}"
#status=xxx
SMTPlist=$(host $domain | grep "handled by" | awk '{print $7}' | sed 's/\.$//' )
address=("${address[@]}" $SMTPlist)
#echo $email ---- $domain ---- $fname ---- $lname
/usr/bin/expect << EOF
set timeout 1
#set echo on
#log_user 0
spawn telnet ${address[4]} $telnetport
expect "220"
send "helo $domain\r"
expect "service"
send "mail from: <[email protected]>\r"
expect "250"
send "rcpt to: <$userid@$domain>\r"
expect {
"250" {
send_user "$userid@$domain validation SUCCESSFUL\n"
**set status "SUCCESSFUL"
puts "status = \$status"**
}
"230" {send_user "ACCESS denied validation UNSUCCESSFUL\n"}
"550" {send_user "$userid@$domain validation UNSUCCESSFUL\n"}
"553" {send_user "Requested action nottaken validation UNSUCCESSFUL\n"}
}
send "quit"
expect "closed"
EOF
printf "$body" "$userid" "$domain" "$fname" "$lname" "$status"
done < $emaillist
Estou tentando definir uma variável do loop while em EXPECT e fazer com que ela retorne ao bash.
**set status "SUCCESSFUL"
puts "status = \$status"**
não tenho certeza se a sintaxe correta é ou se algo está faltando. Qualquer entrada é muito apreciada. obrigada.