Quantcast
Channel: Active questions tagged expect - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 157

spawn_id is empty when setting

$
0
0

I am running an except script where it spawns a c program, waits for an output from the program, and then spawns another program. After that program has finished, I want to send to the original program that was first spawned, but I get the spawned id exp7 not open.

I then tried to get the value of the spawn_id before spawning a new process, but apparently, it is empty, since when I try to doset old_id $spawn_idI get the error saying that old_id is not defined.Do you have any tips on how to spawn a process, then spawn another process, and after that process has finished, to send something to the first process?

Code for the expect script

spawn ./practiceset id $spawn_idexpect "Enter:\r"spawn ./practice2expect eofset spawn_id $idsend "he"expect eof

The code in practice and practice2 doesnt make a difference, so I will not post them


Viewing all articles
Browse latest Browse all 157

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>