In <20091010042217.gd2...@samad.com.au>, Alex Samad wrote:
>Hi
>
>i have this
>
>RDSCHM="--remote-schema 'ssh -i /root/.ssh/id_backup -C  %s
>rdiff-backup  --server'"
>
>
>and trying this
>
>rdiff-backup \
>       $RDSCHM \
>       $RDRM \
>       "$DEST/"

Sorry, there's no clean, portable way to have both multiple command-line 
arguments in a single variable and have an IFS character in one of those 
arguments.

When you do this rdiff-backup gets these arguments:
argv = {
 [0] = "rdiff-backup"
 [1] = "--remote-schema"
 [2] = "'ssh"
 [3] = "-i"
 [4] = "/root/.ssh/id_backup"
 [5] = "-C"
 ... /* etc. */
}

If you force your script to be executed with bash (NOT dash or just sh) you 
can use shell arrays to do what you want:

RDSCHM=(
 '--remote-schema'
 'ssh -i /root/.ssh/id_backup -C %s rdiff-backup --server'
)

rdiff-backup \
        "$rdsc...@]" \
        $RDRM \
        "$DEST/"


You can also force your to work correctly under dash / sh, but you'll have to 
understand how to use eval, which can get a bit tricky.  It would look 
something like this:

RDSCHM="--remote-schema \
'ssh -i /root/.ssh/id_backup -C %s rdiff-backup --server'"

eval "rdiff-backup $RDSCHM $RDRM "'"$DEST/"'
-- 
Boyd Stephen Smith Jr.                   ,= ,-_-. =.
b...@iguanasuicide.net                   ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy         `-'(. .)`-'
http://iguanasuicide.net/                    \_/

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to