# Export Variables From a File

If you store environment variables in a file and want to quickly export all of them it is actually not as simple as running an `export` on each line.

```bash
# source $MY_FILE
# export $(cut -d= -f1 $MY_FILE)
```
[source](https://unix.stackexchange.com/questions/79064/how-to-export-variables-from-a-file)

Another thing you can do is update `~/.bashrc` or equivalent files for other shells and add a method to do this for you since those commands aren't easy to remember.

```diff
# ~/.bashrc
+ # exports variables stored in a file
+ function export_file() {
+   source $1
+   export $(cut -d= -f1 $1)
+ }
```