Skip to content

Instantly share code, notes, and snippets.

@justinmklam
Created December 2, 2020 05:55
Show Gist options
  • Save justinmklam/bc3e8a01e1b7d80c14acb7e0d3af5433 to your computer and use it in GitHub Desktop.
Save justinmklam/bc3e8a01e1b7d80c14acb7e0d3af5433 to your computer and use it in GitHub Desktop.
Export a file of env variables. Source: https://unix.stackexchange.com/a/79077
## Option 1
# Set all variables to be automatically exported
set -a
# '.' is the standard way to source variables. 'source' is available in most Bourne shells
. .env
# Disable automatic export
set +a
# Option 2 (for POSIX shells)
set -o allexport
source .env
set +o allexport
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment