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

Is it possible somehow to import all environment variables which are exported by a subprocess started by Fish?

E.g. from my Fish session, I start bash ~/.profile, which exports some variables and I want to import those in the Fish session.

(This would also be one solution to my other question; however, this would be much more general. E.g. this would also be a solution to this question.)

share|improve this question

Linux has the /proc/<pid>/environ file which contains null-separated environment variables which you could read and import into your fish session.

share|improve this answer

There's no built-in Unix-standard way for a child process to modify the parent process's environment variables, but you could script it up yourself. You could have the child process dump its environment (which is really just a bunch of strings in the format "name=value"), and send it one way or another to the parent, and have the parent walk through the list and export for itself any variables that are new or different (with exceptions for things like $SHELL and $PPID of course).

share|improve this answer

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.