4

I am trying to run a shell (sh) script for backups, using rdiff-backup. The lines of interest are:

cmd="${prog} -v5 --print-statistics --include-globbing-filelist ${inclist} \
--exclude ** ${src} ${dest}"
echo "${cmd}"
$cmd

It echoes the correct command to me, but chokes on the command itself:

rdiff-backup -v5 --print-statistics --include-globbing-filelist /etc/backup/include-list --exclude ** / /backup/all
Using rdiff-backup version 1.2.8
Fatal Error: Switches missing or wrong number of arguments
See the rdiff-backup manual page for more information.

Running the command directly does work (using '**' instead of **). Note that I've tried using '**' in the command string, but it's expanded wrong and gives an error like

Fatal Error: Fatal Error: The file specification
    ''**'
cannot match any files in the base directory
    '/'
...

But I assume this is still an expansion issue, so maybe that's wrong. I am very confused at the moment, and would appreciate some help.

2
  • 1
    Add set -xv to print out the command as debugging help. Maybe it will help.
    – bbaja42
    Oct 15, 2012 at 9:44
  • I tried that, actually. It gives me the same string echoed above.
    – scry
    Oct 15, 2012 at 19:59

1 Answer 1

2

I solved running bash -c "$cmd"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.