Filenames with blanks

jw schultz jw at
Sat Aug 24 13:13:00 EST 2002

On Sat, Aug 24, 2002 at 02:04:07PM -0700, Wayne Davison wrote:
> On Sat, 24 Aug 2002, Ivan kovalev wrote:
> > 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.
> No.  Quotes are completely irrelevant since the shell is _only_ doing
> word-splitting, not arg parsing as the final step before sending the
> args to rsync.
> In other words:
>     `echo 'this is a command'`
> Turns into 4 separate args no matter what characters you add.  No amount
> of quoting, backslashing of spaces, or any other character additions
> will affect this because the only thing that backtick does is split the
> output on whitespace (using the contents of $IFS as the list of
> characters to use for the splitting).
> If you could change the IFS environment-variable value that the remote
> shell was using *when it was parsing the backticks* and make it have
> only a newline in it, that would cause the backticks to only split args
> on lines and not spaces, which is exactly what you want.  However, I see
> no easy way to get the remote shell into that mode (unless you can
> figure out some way to have the startup scripts conditionally set IFS
> based on the command that is about to run).
> In zsh and bash, the syntax $(...) is often a better way to say `...` in
> complex commands (since it's easily nestable).  Both shells let you say
> this (adding double quotes):
>     "$(ls -1)"
> This causes the whole output to be put into a single arg without any
> word-splitting.  However, we need the output split on newlines, so in
> zsh, this is trivial using the 'f' modifier (which is easier than saying
> "ps:\n:" -- i.e. split on newlines).  In other words, using this in zsh
> works perfectly:
>     ${(f)"$(ls -1)"}
> instead of this, which splits on too much whitespace:
>     `ls -1`
> I have no idea if bash has a way to selectively split args into multiple
> args (assuming you use bash).  This splitting has to be a shell-level
> construct because we have to turn output into args as the last step.
> If you feel like stepping up to what I consider to be the best shell
> around, feel free to give zsh 4.x a try.  It has the best commandline
> completion I've ever seen (though it's not on by default), and it has
> all the amenities that a bash user would expect and then some.  You'll
> find everything you need to check it out here:
> If you're not that adventurous, maybe someone else who knows bash (or
> whatever shell you're using) could mention if this is possible.

I can't find anything in bash that would allow setting the
IFS for such a short context.  It has to only apply when
doing the word-split on the results of find, not on the find
commandline or the outer commandline.

For this special case it might be reasonable to specify
force the shell for the ssh to be zsh.

I used to run zsh but the ubiquity of bash won out. 
It was about 10 years ago but even then zsh was quite nice
and i recall missing a few features (but can't remember
which) when i switched.

	J.W. Schultz            Pegasystems Technologies
	email address:		jw at

		Remember Cernan and Schmitt

More information about the rsync mailing list