I have a directory with a list of files containing environment variables; for example a file named REALM that has the contents "dev", a file named TZ that has the contents "UTC", etc.
I'd like to set these in the current process environment, for example as part of .bash_profile
. A tool exists to do this - envdir
- however that's normally used when starting a subprocess.
Is there a good way to do this? At the moment I'm checking whether they are set in the .bash_profile
and calling exec envdir /path/to/env bash
if they are not set, though that seems hacky and risks a recursive loop.