how to export variables back to the parent process
Can't be done. The only reliable way to pass anything to the parent process is to echo it and have the parent process capture it with command substitution.
VAR=$(./myprogram)
Actually... I got this to work just now using source
If myprogram
contains:
export VAR=TRUE
then after running source myprogram
your case will work.