> -----Original Message----- > From: Mayank Ahuja [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 23, 2002 3:15 AM > To: Perl > Subject: Can IPC work? > > > Hi All, > > Please go through the following scenario: > > A perl script has been invoked from shell A. Within the perl script, I > open a new terminal (say B) allowing the user set a > particular variable > to his choice. The user sets the variable in this terminal > and will exit > the terminal so that the perl script continues to work. > > Putting it graphically, > > > A > | > | > |------- > | | > | B > | (New Terminal) > | [User sets a variable] > | > | > (execution of the script continues once B is over) > > > Is there a way by which Shell A can come to know of the value of the > variable set in B? > I don't know anything about IPC...can it work in this scenario?
I assume by "new terminal" you mean a shell invoked by system() or similar, correct? Given that, there is no direct way for process B to update the environment of process A. The two must cooperate to make this happen. Your options are: 1. A can retrieve B's exit status, which is a number. 2. B can send a signal to A, which A can handle. 3. B can write some information to a file, which A can later read. 4. B can talk to A through some IPC mechanism: pipes, sockets, shared memory, message queues, etc. Some shells may allow you to set up an action to happen when the shell exits; this may be a hook where you can write the environment to a file or pipe in order to pass information back to A. Such a mechanism could probably be defeated rather easily though... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]