From Khelair@VERT/TINFOIL to All on Sat Jun 13 00:06:06 2015
I'm working with the following shell script for automating a task that I need to accomplish for one of my clients... Unfortunately the version that I've written is having some really weird bugs creeping up when it's executed as a shell script. It's proving pretty problematic to debug, as when I throw the script into debugging mode and cut 'n paste the actual command that it's trying to execute into the shell, it works just fine. When it's trying to execute via the script I get the following error:
Rsyncing /server/assets with options: -vHrltD -e \'ssh -p 22\' email@example.com:/server/assets /server/assets
Unexpected remote arg: firstname.lastname@example.org:/server/assets
rsync error: syntax or usage error (code 1) at main.c(1201) [sender=3.0.6]
I thought at first that perhaps there was an issue with the way that I had used the quoting within the shell. I've had other weird, esoteric kinds of errors due to quoting incorrectly via shell script previously. So I went back through the script that follows and ended up escaping all occurrances of the single-tick (') quoting, but still ended up getting the same error.
So anyway, if there are any shell script wizards in the house, any you've got any ideas on why this is failing as a script, but working when I cut 'n paste the debugging output of the command straight into the shell, I'd greatly appreciate any feedback you might be able to offer.
# script's functionality is to rsync static assets from whatever directory
# (specified in constants) from production to whatever directory specified on
# command line with an optional default (later, meh, nunathismattahs)
SOURCE='10.183.1.251' #use the quick link; this'll break quick
if [ -n "$1" ] ; then
if [ $VERBOSE -gt 0 ] ; then
RSYNC_OPTS="-vHrltD -e 'ssh -p 22' $USER@$SOURCE:$STATIC_ASSETS \
RSYNC_OPTS="-HrltD -e 'ssh -p 22' $USER@$SOURCE:$STATIC_ASSETS \
if [ $DEBUGGING -eq 0 ] ; then
if [ $VERBOSE -gt 0 ] ; then
#RSYNC_OPTS="-vHrltD -e 'ssh -p 22' $USER@$SOURCE:$STATIC_ASSETS \
From Brian Wallace@VERT/TIME/BATTLEST to Khelair on Sun Feb 14 08:44:02 2016
Re: Shell script issue; rsync error wtf
By: Khelair to All on Sat Jun 13 2015 12:06 am
I've been getting a lot of rsync errors the last month or so, I think it's rsync on 64 bit vs older 32 bit (and less) systems. Check the versions. You seem to say it works OK if you just copy and paste the command you want? I think that's because of buffering-pipes have limited buffer sizes and rsync uses pipes. rsync is more like a shell on top of scp, so when rsync fails I fall back to scp to get it done. I have a WDMyCloud which is Ubuntu under the hood, and rsync on that almost never fails, but my AMD 64 bit machine fails like crazy as the WDMyCloud and all my other systems are 32 bit. They started handling things differently with 64 bit systems and it's not all ironed out and compatable yet. Not sure if there's an option for that, but there might be, I haven't figured out my problems with it really, just know 64 bit vs 32 bit is part of it. I know that because all the 32 bit systems work together fine, it's just the 64 bit system that has problems to everything else. I'll try to let you know if I find a fix for my use as it should help yours too.