Sponsored Content
Top Forums Shell Programming and Scripting expect_out buffer no such variable running script background Post 302458364 by shellscripter on Friday 1st of October 2010 01:34:45 AM
Old 10-01-2010
expect_out buffer no such variable running script background

I am trying to use send and receive using expect. the expect_out(buffer) is working fine while it is running it as foreground. But the same script when it is ran as background, the expect_out(buffer) errored out.

Is there any factor influence when we run script in foreground and in background?

Please through some lights on this.

sample part of script

<..>
send "RTRV-COND-ALL:::P;";
expect ">"
set out $expect_out(buffer)
puts $out
<..>

---------- Post updated 10-01-10 at 11:04 AM ---------- Previous update was 09-30-10 at 11:37 PM ----------

Issue got fixed. The expect_out(buffer) is working fine while running in background...

It was an environmental issue.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to export a variable from a child process running in background to the parent

Hi All, I have a script which calls a child script with a parameter to be run in the background . childscript.ksh $a & Can any one suggest me how do i export a variable from the child script to parent script? Note that the child script is in background If the child script is in... (3 Replies)
Discussion started by: aixjadoo
3 Replies

2. UNIX for Advanced & Expert Users

send a new value to a variable in a running background process

Hi guys, I have a issue with a background process, I need to update the value of a variable in that process which is running at this time and it will be running for at least 2 days. Any idea? I will apreciate your help. regards. Razziel. (2 Replies)
Discussion started by: razziel
2 Replies

3. Shell Programming and Scripting

expect_out(buffer) empty

I have only some info into my buffer, but after a rssi command I see the folowing lines expected into buffer but not present : rssi=-106 rssi=-109 I see in my buffer only the first part of the output, here you are a part of script : #!/usr/bin/expect -f #global expect_out match_max 10000000... (1 Reply)
Discussion started by: ugobale
1 Replies

4. Programming

[SOLVED] Flushing expect_out(buffer) inside a loop

Greetings, Having an issue with the expect_out(buffer). in a foreach loop through some switches I am grabbing some arp table information and writing it out to output files (1 each for each switch looped through). The first iteration works fine. the second iteration of the loop writes the... (0 Replies)
Discussion started by: SuperSix4
0 Replies

5. Shell Programming and Scripting

Return variable value from a script running in background

I have a script which runs a script in the background. Now the script running in background returns some variable value and i want to catch return value in the parent script. e.g. Parent Script : #!/bin/bash ./Back.sh & pid=$! echo "a=$a" echo "b=$b" echo "d=$((a+b))" wait $pid ... (4 Replies)
Discussion started by: Shaishav Shah
4 Replies

6. Shell Programming and Scripting

Expect_out(buffer) works but it doesn't get all lines

Hello "expect" experts I am new at Expect. I have searched for a little while how to capture multiple lines with Expect and I am almost succeeded on that but I don't get all the lines of a command's output that the script executes on a server. Here is how my script works in a nutshell - ... (6 Replies)
Discussion started by: capacho6666
6 Replies

7. Shell Programming and Scripting

Export variable to another script running in background

i have a script inside which i have generated a background job which will run another script. How do i export the variables from parent script to the child script which wil run in the background . a.sh:- export tmpdir="/usr/tmp" nohup b.sh& b.sh:- echo $tmpdir But... (1 Reply)
Discussion started by: millan
1 Replies

8. Programming

Flushing expect_out(buffer)

Can some one tell me how to flush expect_out(buffer)? below is my code expect -re {.*} {} expect "swpackages>*" send -i $con "trial.bat \r" set outcome $expect_out(buffer) expect "*continue*" set prevreport $expect_out(buffer) send "\r \r"; problem is :- I am getting "pre" stuffs... (0 Replies)
Discussion started by: cityprince143
0 Replies

9. Shell Programming and Scripting

Jumbled output in expect_out(buffer)

I have a code like this : set ipv6_acl_max_chars test_acl_max_chars123456a789%s%d2345678ww134rt789qa23456789012345%c89012%a56789012x4r67890test_acl_max_chars1234567890.01234aabcdob34567aBC0 spawn telnet $myip expect "Login:" { send "admin\r" } expect "Password:" {send "admin\r" }... (0 Replies)
Discussion started by: ylucki
0 Replies

10. Shell Programming and Scripting

Trying to parse expect_out(buffer)

trying to telnet to a device, list the files, and delete them. I can get the script to telnet and log in OK, and even issue the command to list out the files. I can't figure out how to parse the expect_out(buffer) and extract the file name for use in the delete command. the files list out like... (4 Replies)
Discussion started by: imatinkerer
4 Replies
FVWM-THEMES-COM(1)						   Fvwm Utility 						FVWM-THEMES-COM(1)

NAME
fvwm-themes-com - fvwm-themes communication center SYNOPSIS
fvwm-themes-com [ --help] [ --version] [ --name name ] [ --message message ] [ --lock-and-get ] [ --get-buffer ] [ --clear-buffer ] [ --buffer-name name ] [ --line lineNbr] DESCRIPTION
This script is not a user script. It is used by Fvwm-Themes for communication between some FvwmScript scripts and some other programs. Basically, you want to start a programs in the background which support the fvwm-themes-com communication protocol (e.g., fvwm-themes-menu- app and fvwm-themes-config with the com-mode option can be used as generic examples), then you can use fvwm-themes-com to ask questions or to give instructions to the background program. The answer are displayed by fvwm-themes-com in the standard out put and can be used by a FvwmScript script via the GetoutPut instruction. The advantage of using this method is that the background program have to do its main job only once (e.g., parsing a lot of informations and storing them in some variables) and a script can have very fast answer from the back- ground program via fvwm-themes-com. OPTIONS
--help - show the help and exit --version - show the version and exit --name name - the name of the communication (e.g., if you start fvwm-themes-menuapp with --com-name pid option you must use menuapp-pid as name to communicate with it). The pipe used for communication are $FVWM_DATADIR/{.tmp-com-in-name,tmp-com-out-name,tmp-com-lock-name}. The "buffer" file is $FVWM_USERDIR/.tmp-com-buffer-name --message - A one line message to be sent to the back program. --lock-and-get - Wait (a certain "time out") for an answer of the message. Then, the answer is displayed on STDOUT. --line n - n must be an integer n > 0. In the case of a lock and get message, fvwm-themes-com will out put only the nth line of the answer of the back program on STDOUT and will copy the complete answer in a "buffer" file. If you use the get-buffer option the nth line of the buffer is out put on STDOUT. --get-buffer - Out put the buffer file on STDOUT. --buffer-name othername - Use an alternative name for the buffer file: $FVWM_USERDIR/.tmp-com-buffer-othername. This is usefull if two pro- grams use the same background program and both use the buffer. --clear-buffer - remove the buffer file. USAGE
Here an example: In the Script FvwmScript-Menus you first start the background program, here fvwm-themes-menuapp, and you set some variables for an easy use of fvwm-themes-com: # found the FvwmScript pid Set $CMD = {perl -e '$t=getppid; print $t . " "'} Set $PID = (GetOutput $CMD 1 -1) # Run fvwm-themes-menuapp until the end of the script Do {Exec fvwm-themes-menuapp --com-mode --com-name=menuapp-}$PID{ &} # to send fvwm-themes-com command Set $SendMsgAndGet = {fvwm-themes-com --name menuapp-}$PID{ --lock-and-get --message=} Set $SendMsg = {fvwm-themes-com --name menuapp-}$PID{ --message=} Set $GetLine = {fvwm-themes-com --name menuapp-}$PID{ --get-buffer --line=} Then in the Script you can ask fvwm-themes-menuapp for some informations: # Get the menu list Set $CMD = $SendMsgAndGet{"menu-items }$MENU{"} Set $ItemsList = (GetOutput $CMD 1 -1) ChangeTitle 11 $ItemsList You can also just send an instruction to fvwm-themes-menuapp: Set $CMD = $SendMsg{"exit"} Do {Exec }$CMD Of course your back program have to support the fvwm-themes-com protocol. See fvwm-themes-menuapp and fvwm-themes-config for examples (com- mode option). See also FvwmScript-Menus and FvwmScript-ThemesCenter. AUTHORS
Olivier Chapuis <olivier.chapuis@free.fr>, 5 May 2000. COPYING
The script is distributed by the same terms as fvwm itself. See GNU General Public License for details. BUGS
Report bugs to fvwm-themes-devel@lists.sourceforge.net 3rd Berkeley Distribution perl v5.6.0 FVWM-THEMES-COM(1)
All times are GMT -4. The time now is 06:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy