Tricky Quoting Issue in BASH

Charles Curley charlescurley at charlescurley.com
Sun Jan 1 12:49:52 MST 2006


I'd like to run an rsync command to do backups, with an exclude
pattern. I can build what looks like a perfectly good command, echo
it, then run it. But the exclude pattern is ignored. However, if I
copy the echoed command line and execute it directly, it works and the
exclude pattern is respected.

Something like:


    # options to feed to rsync

    opts="-va --exclude '*~' --delete --delete-excluded"

    ....


    cmd="rsync $opts $internal$back/ $external$back"

    echo $cmd

    $cmd


Thanks

-- 

Charles Curley                  /"\    ASCII Ribbon Campaign
Looking for fine software       \ /    Respect for open standards
and/or writing?                  X     No HTML/RTF in email
http://www.charlescurley.com    / \    No M$ Word docs in email

Key fingerprint = CE5C 6645 A45A 64E4 94C0  809C FFF6 4C48 4ECD DFDB
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://plug.org/pipermail/plug/attachments/20060101/538ab910/attachment.bin 


More information about the PLUG mailing list