Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm try to export variables back to the parent process.

$ export VAR=FALSE
$ echo $VAR
FALSE
$ ./myprogram
$ echo $VAR
TRUE  <========== I want to print `TRUE` here
share|improve this question

1 Answer 1

up vote 2 down vote accepted

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)
share|improve this answer
    
I think some programs even have options to format their output accordingly. –  Daniel Beck Dec 20 '11 at 6:12
    
Depends what you mean with reliable. Named pipes are a pretty reliable way, without race conditions. –  Pithikos Sep 4 at 17:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.