You are here: Home / Blogs / How To Batch-set Environment Variables

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
Filed under: , ,
Add comment

You can add a comment by filling out the form below. Plain text formatting.

Question: What is 5 + 8 - 3 ?
Your answer: