I have a script find-files
that produces paths that can contain space in lines
/foo bar
/abc
I want to convert these paths to arguments that get to pass to another command cmd
like this:
cmd -f "/foo bar" -f "/abc"
I tried this
cmd $(find-files | sed 's/^/-f /')
But it passes paths containing space as multiple arguments.
and if I quote the substitution, the whole string gets passed as a single argument.
What's the correct way of doing that?
BTW, this is not the same question as asked here, which suggested eval
. eval
doesn't help with dealing spaces at all.