Re: starting a background process
- From: Uwe Klein <uwe_klein_habertwedt@xxxxxxxxxxx>
- Date: Tue, 31 Oct 2006 11:07:13 +0100
Kimi wrote:
Hi,set timeout 2
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 kimi@xxxxxxxxxxx
set ::tmcnt 0
set ::tmstr {|/-\|/-\}
expect {timeout {
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"
}
set ::tmcnt [ expr {($::tmcnt+1) % 8} ]
send_user [ string index $::tmstr $::tmcnt ]\b
exp_continue
}
}
uwe
.
- References:
- starting a background process
- From: Kimi
- starting a background process
- Prev by Date: Re: write binary file with struct in tcl
- Next by Date: Re: Tcl/Tk Books updated for 8.5
- Previous by thread: starting a background process
- Next by thread: ANNOUNCE: Splash library 0.3
- Index(es):
Relevant Pages
|