Re: starting a background process



Kimi wrote:
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 kimi@xxxxxxxxxxx
set timeout 2
set ::tmcnt 0
set ::tmstr {|/-\|/-\}

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"
}
timeout {
set ::tmcnt [ expr {($::tmcnt+1) % 8} ]
send_user [ string index $::tmstr $::tmcnt ]\b
exp_continue
}
}


uwe
.



Relevant Pages

  • behavioral change of "read" builtin for sh on 8-CURRENT
    ... This script waits for terminal input for each of the above variables (INT, ... On 8-CURRENT if I hit Enter with no input at the prompt the system seems to ... recognize the newline as input and continues to sit there until I hit Enter ... Enter network interface: ...
    (freebsd-current)
  • behavioral change of "read" builtin for sh on 8-CURRENT
    ... This script waits for terminal input for each of the above variables (INT, ... On 8-CURRENT if I hit Enter with no input at the prompt the system seems to ... recognize the newline as input and continues to sit there until I hit Enter ... Enter network interface: ...
    (freebsd-questions)
  • Re: behavioral change of "read" builtin for sh on 8-CURRENT
    ... This script waits for terminal input for each of the above variables (INT, ... On 8-CURRENT if I hit Enter with no input at the prompt the system seems to ... recognize the newline as input and continues to sit there until I hit Enter ... Enter network interface: ...
    (freebsd-current)
  • Re: behavioral change of "read" builtin for sh on 8-CURRENT
    ... This script waits for terminal input for each of the above variables (INT, ... On 8-CURRENT if I hit Enter with no input at the prompt the system seems to ... recognize the newline as input and continues to sit there until I hit Enter ... Enter network interface: ...
    (freebsd-questions)
  • RE: Internet explorer will not update
    ... Connections>> Double click Internet Options, ... Automatic prompting for ActiveX controls ... Prompt ... Initialize and script ActiveX controls not marked as Safe ...
    (microsoft.public.windowsxp.general)