ersiner / osx-env-sync

Synchronize OS X environment variables for command line and GUI applications from a single source
Apache License 2.0
219 stars 36 forks source link

Should this follow "source" calls? #2

Open edenman opened 7 years ago

edenman commented 7 years ago

My ~/.bash_profile just has one line: source .bashrc. For now I've just changed .osx-env-sync.sh to read from that file, but that's obviously not ideal. Would be cool if we could follow the chain of source calls. I could imagine some people splitting up their bashrc into several files based on area of concern, for instance.

plijnzaad commented 5 years ago

I would be in favour of adding this, but it's not trivial (the sourced file could itself source yet more files in turn).

Other than that: kudos to @ersiner for this nice little life-saver

jiacai2050 commented 4 years ago

I have a similar config, here is my solution:

source ~/.bash_profile
/usr/bin/env | while IFS=' =' read envvar ignorevalue; do
  launchctl setenv ${envvar} ${!envvar}
done