Filenames with blanks

Ivan kovalev ivan at wssource.com
Sat Aug 24 11:12:00 EST 2002


Thank you for interesting remark, Wayne.

I made a test directory with only one file there ("Conference Calls"), so
that if I run find for files only and quote output, that should be the
equivalent of the COM you suggested. Still, it gets split on white space.
You are definetely right about ticks, because if I replace COM for
explicit quoted filename, that works fine.

Still, I am not sure if I understand your suggestion. Looks like you are
saying: have output from COM like this:
/a/b/c d
/a/b/efg

May be each line quoted. And this is exactly what I already have when I
run this command on the SRC host. Still it is being splitted on white.
Please clarify if your COM would produce this output or not.

Ivan

 On Sat, 24
Aug 2002, Wayne Davison wrote:

> On Sat, 24 Aug 2002, jw schultz wrote:
> > Your example does not scan src_host it scans targ_host.
>
> Not so.  If you look carefully at Ivan's quoting, you'll note that
> he put the backticks inside single quotes, which saves them for the
> $src_host.  For instance:
>
>     COM='`ls -1d f*`'
>     rsync -av $src_host:"$COM" /tmp
>
> That command would work just like this simpler command:
>
>     rsync -av $src_host:f\* /tmp
>
> Ivan Kovalev wrote:
> > COM='`find '$src_dir'  -mtime -'$days' -type f `'
> > rsync -rxlupogtSvve ssh  $src_host:"$COM" $targ_dir
>
> The quoting problem is a shell problem due to the backticks.  Backticks
> split the string at spaces, regardless of the quoting or backslashing
> that you may attempt to use in the output (which is ignored because the
> shell isn't doing parsing there, just word-splitting).  To fix this,
> you'll have to affect how the backticks split the output.  I can't
> figure out a way to get rsync to set IFS in the right spot to affect
> just the backtick expansion, so perhaps the only solution is to use a
> different command-running syntax.
>
> If your login shell is zsh, you could use this command:
>
>     COM='${(f)"$(find '$src_dir' -mtime -'$days' -type f)"'
>
> This quotes the find command's output (so that it doesn't get split),
> and then explicitly splits the output based on newlines.  I don't know
> if bash has something similar (since I don't use bash).
>
> ..wayne..
>
>




More information about the rsync mailing list