Environmental Variable

Hi,

I'm exporting an environmental variable from a C program using putenv function. I'm calling the exe of the C program from shell script. But when I display the environmental variables from the Shell script, My varaible is not getting displayed.
Can anyone please tell me how to get it in shell script ?

Thanks,
Jane A

The C code runs in a child process. Any variable created there is not seen by the parent. If C the code wants to have the variable set in the parent it will have to print it, then the parent will have to read what the child process wrote.

in my_c_program somewhere:
printf("MYENV=%s\n", new_value_for_variable)

shell:

#!/bin/ksh
new_env_var=$(my_c_program| awk -F= '{ if($1=="MYENV") {print $2} }' )
export new_env_var

Hi Jim !

Thank you so much. It worked.

Jane A