parse .env file and set environment variable in shell
# put in bin folder of current user if you have bin folder in your $PATH
curl https://github.com/raw/zhiyelee/dotenv/master/dotenv.sh > ~/bin/dotenv
# or /usr/local/bin to share with multiple users
curl https://github.com/raw/zhiyelee/dotenv/master/dotenv.sh > /usr/local/bin/dotenv
# grant all users execution permissions
chmod a+x /usr/local/bin/dotenv
dotenv run_my_command --any-option option1 param1 param2
Suppose we have an .env
file like
# `#` started comment will be ignored
USERNAME=zhiye
# space and quote will be reserved
ORGANIZATION="TUBI TV"
TEAM=WEB
dotenv python app.py
equals to
USENAME=zhiye ORGANIZATION="TUBI TV" TEAM=WEB python app.py
ISC