title: Bash script that creates a directory structure
body: <p>I've been googling all night trying to find a way to create a script that creates a directory structure. That looks something like this:</p>
  
  <pre>
  /
  shared
  shared/projects
  shared/series
  shared/movies
  shared/movies/action
  </pre>
  
  <p>You get the point.   </p>
  
  <p>The file that the script reads from look like this:   </p>
  
  <pre>
  shared backup
  shared data
  shared projects 
  shared projcets series
  shared projects movies
  shared projects movies action
  </pre>
  
  <p>I want to create a script that reads each line in the file and run the following for each line:
  If the directory exist, it places itself in the directory and create the structure from there, if
  The directory doesn’t exist, create it.<br>
  When all entries in the row have been preceded by, go back to original directory and read the next line.</p>
  
  <p>My system is Ubuntu 10.10.</p>
  
  <p>So far I’ve done this, but it doesn’t work. </p>
  
  <pre><code>#!/bin/bash
  
  pwd=$(pwd)
  
  for structure in ${column[*]}
  do
    if [ $structure ]
    then
      cd $structure
    else
      mkdir $structure
    fi
  done
  
  cd $pwd
  </code></pre>