No, you can't set an environment variable in a child process and expect to propagate that change back to the parent process.
And yes, you can absolutely "pass a specific value" from a shell script back to the calling C program. There are *countless* different ways. A few that come immediately to mind are:
1. Use "result = system (cmd)" to read back the return status from the shell program
2. Use "popen (cmd, "r")" instead of "system (cmd)" and then read back whatever
the shell writes to stdout ('popen()" uses pipes to let you read the shell program's
output as though it were a disk file).
3. Have your shell write some output to a data file, then have your C program
open and read the file.
Etc etc etc
It all depends on what your requirements are, and what tools you have at hand.
'Hope that helps .. PSM
|