[Wylug-help] quotes within quotes within bash

Craig Hopkins c.o.hopkins at gmail.com
Fri Nov 21 18:36:11 UTC 2008


2008/11/21 Stephen Patterson <steve at patter.mine.nu>:
> 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.

Same error message :) With or without the escaped \" in the args

Craig

>
> --
> Stephen Patterson
> 186k Limited
> E-mail: stephen.patterson at 186k.co.uk
>
> _______________________________________________
> Wylug-help mailing list
> Wylug-help at wylug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/wylug-help
>



More information about the Wylug-help mailing list