title: Set environment variables from file of key/value pairs
body: <p><strong>TL;DR:</strong> How do I export a set of key/value pairs from a text file into the shell environment?</p>
  <hr />
  <p>For the record, below is the original version of the question, with examples.</p>
  <p>I'm writing a script in bash which parses files with 3 variables in a certain folder, this is one of them:</p>
  <pre><code>MINIENTREGA_FECHALIMITE=&quot;2011-03-31&quot;
  MINIENTREGA_FICHEROS=&quot;informe.txt programa.c&quot;
  MINIENTREGA_DESTINO=&quot;./destino/entrega-prac1&quot;
  </code></pre>
  <p>This file is stored in <code>./conf/prac1</code></p>
  <p>My script <code>minientrega.sh</code> then parses the file using this code:</p>
  <pre><code>cat ./conf/$1 | while read line; do
      export $line
  done
  </code></pre>
  <p>But when I execute <code>minientrega.sh prac1</code> in the command line it doesn't set the environment variables</p>
  <p>I also tried using <code>source ./conf/$1</code> but the same problem still applies</p>
  <p>Maybe there is some other way to do this, I just need to use the environment variables of the file I pass as the argument of my script.</p>