Skip to content

Instantly share code, notes, and snippets.

@mojowen
Last active March 18, 2016 22:39
Show Gist options
  • Save mojowen/baa52d0ddf695c0d6129 to your computer and use it in GitHub Desktop.
Save mojowen/baa52d0ddf695c0d6129 to your computer and use it in GitHub Desktop.
Load ENV file into
#!/usr/bin/env bash
# Use on .env files, structured as KEY=VALUE. Will load into bash env
# Must be called with $ . load.sh
ENV_FILE=${1:-'./.env'}
cat $ENV_FILE | awk -F"=" '{print "Loading " $1}'
declare -a $(cat $ENV_FILE | awk -F"=" '{print $1"="$2}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment