How to pass a string to a parent script?
-
My problem is the following.
I have an app that is started from a shell script. After an app is quit the script needs to get a string value my app dealt with. I was thinking a good solution would be to use environment variables, but unfortunately after my app is exited all variables that it has set usingqsetenv
orQProcessEnvironment::systemEnvironment().insert()
become inaccessible even for a script application was started from. Any ideas? -
-
@0-5
You're not "parsing" stdout. You're just taking its value. E.g.bash
script linevar=$( command )
looks pretty simple to me. Since there is no way of having a sub-process alter the environment variables of the parent, it's moot as to whether you would prefer it.
-
@0-5
So then clearly stdout is not where your app should "return" its value. Maybe stderr, maybe some other file handle number, looks like you might be happiest with send to file in this situation to avoid ambiguity.What else would you like us to say? You can't do it via environment variables, and you can't get a string from the integer return result of a process, so....
-
Hi,
If your output follows a known pattern then parse stdout to extract what you want.