[Wylug-help] quotes within quotes within bash

Craig Hopkins c.o.hopkins at gmail.com
Fri Nov 21 17:39:24 UTC 2008


Hi all,

Say for example I have in my bash script:

MYARGS="-a --delete -e \"/usr/bin/ssh -p1234\" "

Why is it that when I do

echo $MYARGS
rsync $MYARGS somefolder/ user at server:
rsync $MYARGS somefolder/ user at server2:

echo prints out the escaped quotes as quotes, but rsync then gets
confused by the space in the -e argument and just thinks that I'm
trying to pass -p to rsync rather than as a parameter on /usr/bin/ssh.
It seems to suggest that it's ignoring any of the quotes inside the
string. I've tried several permutations but nothing seems to give
success. Any hints welcome :)

Craig



More information about the Wylug-help mailing list