title: Dynamically generate directory structure from text file
body: <p>Given the following text file which contains a list of directories, how would you automatically generate the file path if it doesn't exist.</p>
  
  <pre><code>apache/bin/
  apache/build/
  apache/error/include
  apache/htdocs/images/
  apache/icon/small
  python/bin
  python/include/python2.7
  lib/pkconfig
  lib/python2.7/bsddb/test
  lib/python2.7/compiler
  lib/python2.7/ctypes/macholib
  lib/python2.7/ctypes/test
  </code></pre>
  
  <p>For example, from the root/start directory, if the line reads <code>apache/bin/</code>, I want to check if the folder <code>apache</code> exists, if it doesn't, then I create it. </p>
  
  <p>After that I want to cd into it, check if the file <code>bin</code> exists, if it doesn't then I create it. Then before moving into the new line, I want to move back into the root directory (i.e. move up two levels).</p>
  
  <p>How would I accomplish this in Bash?</p>