I want to execute a command in a
bash script which has this style:
rdiff-backup --verbosity 5 -somearguments -somemorearguments \ --remote-schema 'ssh -i $keyfile -C %s' \ sourcedir backup::/targetdir
The problem appears with the
--remote-schema argument. I have to make the ssh-key variable, in this example with
I construct the resulting command in
$rdiffcmd. I do not have a problem to construct a command where everything looks like it should work: An
echo $rdiffcmd shows the necessary quotes around
--remote-schema. But there has to be an invisible expansion because I always get the message that
rdiff-backup (on the local side) does not understand
-i. So it is not using the quotes.
What do I have to do to group the remote-schema together and make it look like one argument?
Very strange: I can paste and copy the output of
echo $rdiffcmd in a terminal and it works. But as
$rdiffcmd in my script it does not with the above problem.