Input two password(pass1/pass2) options for single node..

Hi Team,
i want to input two password for single node like pass1/pass2 one of the pass1 is working some node and pass2 is working for some nodes .
For nodes having pass1 i have to run diffrent script and
for nodess having pass2 i have to run diffrent script

Sooo
how can put two pass (Pass1/pass2)option in single script..

I m using.

1st script is like........

#!/usr/bin/expect
spawn telnet $ip
expect "login:"
send "USR\r"
expect "*assword*"
send "pass1\r"
expect "*$"

2nd script is like........

#!/usr/bin/expect
spawn telnet $ip
expect "login:"
send "USR\r"
expect "*assword*"
send "pass1\r"
expect "*$"

i want both pass1&pass2 option in single script , how can i do it????

---------- Post updated at 02:51 AM ---------- Previous update was at 02:04 AM ----------

Can any one help me??

Using expect to get past a login process is usually a bad idea for several reasons, however rather than bang on about them, have you considered either setting up rlogin permission or better still generating ssh-keys and using ssh to automate the submitting of work to the other server?

Robin