0

I'm building a command line up in a tcsh shell variable, something like

set cmd  = "/usr/local/bin/rsync "
set parm = "--verbose --acls --times --links "
set src  = "/spindle/to\ be\ backed-up "
set dest = "/mnt/backup21 "

set final = "$cmd $parm $src $dest"

$final

and I'd like the last line to execute the command. I can get this to execute, but always with the error

rsync: link_stat "/spindle/to\" failed: No such file or directory (2)

It doesn't seem to properly see the space in the path. I tried multiple \ in that line, still didn't work. Suggestions?

1 Answers1

0

First off, I'd seriously consider finding a different way to do this. csh is widely considered to be a poor shell for programming; see the classic article Csh Programming Considered Harmful. I've been using csh and tcsh for more decades than I care to admit, and I still have to resort to trial and error to answer questions like this.

But for your immediate question, eval seems to work. Replace the line

$final

by

eval $final
Keith Thompson
  • 254,901
  • 44
  • 429
  • 631