| |||||||||||
starting a background process Posted by shafa.fahad (FahaD), 31 October 2006 Hi,I would like to know how to spawn a back process in Expect/TCL. A piece of code would be helpful.... I have a script which logs into remote system and does serious of operation and bring out the output. find below the simple script for reference... #!/usr/bin/expect -f set prompt "(%|#|\\$|%]|\\):|>) $" spawn ssh k...@10.67.45.80 expect { password { send_user "Enter password for $cStruct(admin):" stty -echo expect_user -re "(.*)\n" {set pStruct(passwd) $expect_out(buffer)} send "$pStruct(passwd)\r" stty echo } -re $prompt { send_user "Please wait the operation is being performed" log_user 0 send "somecommand\r" expect -re $prompt send "somecommand\r" expect -re $prompt send "somecommand\r" expect -re $prompt send "somecommand\r" expect -re $prompt send "somecommand\r" expect -re $prompt send "somecommand\r" expect -re $prompt set result $expect_out(buffer) puts stdout $result send "exit\r" } } In the above operation, after user enters the password he will get the message "please wait the operation is being performed" and then because of log_user 0 user wont get to see what command is fired and after some time he will get the result. My requirement is to display "please wait while the operation is being performed" to be dynamic and hence keeps blinking till the operation is complete. Any help would be apprecited. Thanks in advance Fahad Posted by admin (Graham Ellis), 1 November 2006 You could spawn a shell and background it via there, but it seems a bit obscure. Also have a look at expect_after which may allow you to return if there isn't a match yet back if the real expression your looking for hasn't appeared. Sorry the reply is a bit patch today - I'm away from base and books!This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |