On Wed, Oct 09, 2024 at 11:49:20AM +0200, oset <o...@superbox.pl> wrote:

> raf wrote: &gt; ... | xargs echo cmd ... Good hack.  Thing is, I tried
> it before and it did not work. That is why I strayed the whole topic.
> Now it works, so thats OK.  There is a problem though: $  echo a &gt;
> a.txt; echo b &gt; b.txt; echo c &gt; &#34;c with spaces.txt&#34; $ 
> echo * | xargs echo gzip | sh gzip: c: No such file or directory gzip:
> with: No such file or directory gzip: spaces.txt: No such file or
> directory If user checks his command line, and decided to use it as a
> script, whether through or script, then it is going tip have problem
> with spaces in names.

Yes, That's because the output of "echo *" doesn't quote anything.
It would work better if you used find instead of echo, and separated
each name with a nul byte, and told xargs to expect nul bytes, like this:

  find . -type f -print0 | xargs -0 gzip -k

cheers,
raf


Reply via email to