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 >set cmd1 "command1" >set cmd2 "logout" >spawn telnet $name >send "$cmd1" >send "$cmd2" >exit sleep 500 done I want to capture the output of issuing the 'command1' on the remote node into a text file , and also append the subsequent outputs into just one file. As you see, the remote node accepts anonymous login so no need to supply user id & pwd. I just need to issue the 'command1' on it and capture the output and then wait for a prescribed time interval and then redo from the start. Please correct me on any mis-understanding. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.centos.org/pipermail/centos/attachments/20100502/818d2a7f/attachment-0005.html>