Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
Add set -xv to print out the command as debugging help. Maybe it will help. –  bbaja42 Oct 15 '12 at 9:44
    
I tried that, actually. It gives me the same string echoed above. –  scry Oct 15 '12 at 19:59

1 Answer 1

I solved running bash -c "$cmd"

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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