I'm trying to create a shell-script to manage my sync with a s3-bucket. Here is what is in my script:
#!/bin/bash
aws s3 sync $1 $2 $(for word in $(echo "$excludeconf"| tr ";" " "); do echo -n "--exclude \"$word\" "; done) $del --no-follow-symlinks $3
$1
is source
$2
is destination
$3
is another parameter that gets passed (dryrun). the $(word...
takes a list of files & folders $excludeconf
and creates --exclude ...
with them.
If I run the script it won't exclude anything.
If I put an echo
in front of the command above, I get this:
aws s3 sync . s3://BUCKETNAME/FOLDERNAME/ --exclude .SOMEFILE --exclude "public/icon/*" --delete --no-follow-symlinks --dryrun
If I copy that command and run it manualy inside the terminal it works just fine.
Any ideas?
FYI: I'm running CentOS 7
Edit:
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 $(..)?