As others have already pointed out, this can be done with a simple
bash script, even if you do use telnet. I'd suggest getting a good
bash reference and learning it, or perl for a more robust interface.
Thank you for your reply. From your first message regarding using expect to do the job , I tried to get more familiar with expect so I sent you my first expect script to see if I have correctly understood it. Actually, my intended expect script must be something like the followings :
#for i in 1 2 3 4 5 6 7 8 9 10
do
/usr/bin/expect
>set name 172.16.17.160