How To Batch-set Environment Variables

Learn how to automatically (dump) set environment variables defined in a file.

Sometimes you have a file (usually called .env or .environment) with dozen of environment variables defined and you have to set those variables before running a command --for example this happens in Django projects with a .env file for settings.

The solution is easy:
export $(cat ENVIRONMENT_FILE | xargs) && YOUR_COMMAND

Comments

Popular posts from this blog

Variables in GNU Make: Simple and Recursive

Checkmate on Your Terms: A Personal Journey with Correspondence Chess

Firefox profiles: Quickly replicate your settings to any machine