Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

$ export VAR=FALSE
$ echo $VAR
$ ./myprogram
$ echo $VAR
TRUE  <========== I want to print `TRUE` here
share|improve this question
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.

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 '14 at 17:14
The easiest way is to echo var=value couples in the child and call eval $(./myprogram). – user93692 Jan 17 '15 at 4:03

Your Answer


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.