[Wylug-help] quotes within quotes within bash

Stephen Patterson steve at patter.mine.nu
Fri Nov 21 18:14:52 UTC 2008


On 21 Nov 08, Craig Hopkins (c.o.hopkins at gmail.com) wrote:
> 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:

Try single-quotes. 

Double quoted strings get expanded (variables populated etc) in scripting
languages, while single quotes don't.

-- 
Stephen Patterson
186k Limited
E-mail: stephen.patterson at 186k.co.uk



More information about the Wylug-help mailing list