|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Expect/Tcl -- Need to access return value of script
Hi, I have an expect script that rlogin's to another system, and executes a few remote commands on that server. I need to capture the return value of one of the commands given, and then return that value to another script (the one that called the expect script). Here is a rough outline of my expect script:
#!/usr/bin/expect -f set prompt "(%|#|\\$|%]) $" catch {set prompt $env(EXPECT_PROMPT)} set timeout 10 set username [lindex $argv 0] set pword [lindex $argv 1] set arg1 [lindex $argv 2] set arg2 [lindex $argv 3] set host "theserver@thehost.com" spawn rlogin -l $username $host expect "Password:*" send "$pword\r" //Connected to remote host expect -re $prompt send "/path/to/the/script $arg1 $arg2 .. need return value of this script expect -re $prompt send "exit\r" //need to return the return value found exit basically it is like this...I call the expect script from php (via exec), it runs on the same server as the webserver, then rlogin's to the other server and runs the scripts...I need to return the return value back to php, can I do this? Thanks! |
![]() |
| Viewing: Dev Shed Forums > Other > Dev Shed Lounge > Expect/Tcl -- Need to access return value of script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|