Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • "a program environment must be explicitly exported to be incorporated into a child processes environment" I'm not sure what that means in reference to my question Commented Sep 27, 2016 at 23:03
  • That's wrong info. On any POSIX compatible shell you can add the variables on the command line and they will be set by the shell after the fork() but before the exec() call. Commented Sep 27, 2016 at 23:43
  • ...only if they are marked for export. Try it: TESTVAR=something \n bash \n echo $TESTVAR \n exit \n export TESTVAR \n bash \n echo $TESTVAR \n Commented Sep 28, 2016 at 10:26
  • But it is meant on the same command line. Try this: unset TESTVAR; echo -n '$TESTVAR='; TESTVAR=yay bash -c 'echo $TESTVAR'. Note that the single quotes prevent expansion but they're dropped before reaching the inner shell. Commented Sep 28, 2016 at 17:20