Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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}"

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

I solved running bash -c "$cmd"

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .