How to use 'expect' to pass UID & Password to a "for loop" in shell script?

Friends,

Need someone's help in helping me with the below requirement for a script:

> For a list of servers(over 100+), I need to login into each of them(cannot configure password-less ssh) & grab few configuration details <

I know, this is possible through expect programming in a simple shell script, but unfortunately I'm not able to get one to work as required. Below is what I could manage to write without expected results:

cat server_list

server1
server2
server3
..
..
..
cat for_loop.sh

for i in `cat server_list`
do
multibos -S
done
cat expect_script.sh

spawn /$HOME/for_loop.sh

expect "*User_ID*"
send "souvikm\r"
expect "*Password*"
send "passw0rd\r"
expect eof
$> ./expect_script.sh

Running the above written expect script doesn't solve my purpose - it does nothing :smiley: Could someone help me rectify this script or help me with a better idea?

-- Souvik

Hmm,

i miss a line like ssh <user>@<server> e.g. ssh souvikm@$i

Regards

Double posting is against forum rules. If you go back to your previous post, you'll see that there is an answer to your question.