title: AWS CLI S3 Sync exclude not working in script, directly in terminal it does
body: <p>I'm trying to create a shell-script to manage my sync with a s3-bucket.
  Here is what is in my script:</p>
  
  <pre><code>#!/bin/bash
  
  aws s3 sync $1 $2 $(for word in $(echo "$excludeconf"| tr ";" " "); do echo -n "--exclude \"$word\" "; done) $del --no-follow-symlinks $3
  </code></pre>
  
  <p><code>$1</code> is source 
  <code>$2</code> is destination
  <code>$3</code> is another parameter that gets passed (dryrun). the <code>$(word...</code> takes a list of files &amp; folders <code>$excludeconf</code> and creates <code>--exclude ...</code> with them.</p>
  
  <p>If I run the script it won't exclude anything.</p>
  
  <p>If I put an <code>echo</code> in front of the command above, I get this:</p>
  
  <pre><code>aws s3 sync . s3://BUCKETNAME/FOLDERNAME/ --exclude .SOMEFILE --exclude "public/icon/*" --delete --no-follow-symlinks --dryrun
  </code></pre>
  
  <p>If I copy that command and run it manualy inside the terminal it works just fine.</p>
  
  <p>Any ideas?</p>
  
  <p>FYI: I'm running CentOS 7</p>
  
  <p>Edit:</p>
  
  <p>after some tests I found out the problem is globbing: the public/icon/* gets interpreted to public/icon/folder1 public/icon/folder2 If I try to set noglob it won't work.. is ist because it is inside $(..)? </p>