mizako 0 Report post Posted August 18, 2004 Hi,I am quite new in Xisto and i do not know if i am supposed to open new topics. If not please let me know. I am using normally Perl at work but now i need to use expect. Expect is a language that allows you to interact with prompts such telnet, ftp and staff like that. I have to interact with some consoles simultaneosly and send both of them commands. Expect uses tcl. I am really new with tcl. I need to open a file and read line by line in order to send those line to a console. Maybe anyone can help me with this basic operation. I think i have to use the exp_open command. In Perl would be something like this: [/br]open <INPUT>, FileName[br] or die "Can't open FileName for reading;[/br]while ( <INPUT> )[br]{[/br]print "$_"; #Operation with the line. I should make more complicated things;-)[br]}[/br] Share this post Link to post Share on other sites
mizako 0 Report post Posted August 20, 2004 Hi,I create a simple Expect script to automate my ftp login into my trap account. I made my ftp uploads running the ftp command in linux so i created this script to save me time in typing my Login and password. It logins for you and returns you the control. I hope it is useful for you guys. Remember just install expect and enjoy it: [br][/br]set host your_name.trap17.com[br]set Login your_name[/br]set Passwd your_password[br][/br]spawn ftp $host[br]expect "Name (*):"[/br]send "$Login\r"[br]expect "Password:"[/br]send "$Passwd\r"[br]expect {[/br] "ftp>" { interact }[br] "Login failed." { exit 1 }[/br] timeout { exit } }[br][/br] Share this post Link to post Share on other sites