bash and fish scripts are not compatible, but I would like to have a file that defines some some environment variables to be initialized by both bash and fish.
My proposed solution is defining a ~/.env
file that would contain the list of environment variables like so:
PATH="$HOME/bin:$PATH"
FOO="bar"
I could then just source it in bash and make a script that converts it to fish format and sources that in fish.
I was thinking that there may be a better solution than this, so I'm asking for better way of sharing environment variables between bash fish.
Note: I'm using OS X.
Here is an example .env
file that I would like both fish and bash to handle using ridiculous-fish's syntax (assume ~/bin and ~/bin2 are empty directories):
setenv _PATH "$PATH"
setenv PATH "$HOME/bin"
setenv PATH "$PATH:$HOME/bin2"
setenv PATH "$PATH:$_PATH"