title: Bash scripting: syntax error near unexpected token `done'
body: <p>I am new to bash scripting and I have to create this script that takes 3 directories as arguments and copies in the third one all the files in the first one that are NOT in the second one. </p>
  
  <p>I did it like this:</p>
  
  <pre><code>#!/bin/bash
  
  if [ -d $1 &amp;&amp; -d $2 &amp;&amp; -d $3 ]; then
      for FILE in [ ls $1 ]; do
          if ! [ find $2 -name $FILE ]; then
              cp $FILE $3
      done
  else echo "Error: one or more directories are not present"
  fi
  </code></pre>
  
  <p>The error I get when I try to execute it is: "line 7: syntax error near unexpected token `done' "
  I don't really know how to make it work! 
  Also even if I'm using #!/bin/bash I still have to explicitly call bash when trying to execute, otherwise it says that executing is not permitted, anybody knows why?
  Thanks in advance :)</p>