A couple of simple bash utility scripts for loading/unloading .env
files.
I store my user scripts in ~/bin
, so that I can run them globally from any directory I am in.
Below are the steps to set that up:
- Create
~/bin
- Copy
envup
andenvdown
to~/bin
directory you've created. - Add
~/bin
toPATH
(I have this in~/.bash_profile
):export PATH=$PATH:$HOME/bin
. envup # To load .env file
. envup custom # To load .env.custom
. envdown # To unload .env stored in DOTENV_PATH env var (created by envup)
Inspired by this gist comment.