1

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.)

2 Answers 2

1

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

0

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).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .