On Wed, Oct 09, 2024 at 11:49:20AM +0200, oset <o...@superbox.pl> wrote:
> raf wrote: > ... | 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 > > a.txt; echo b > b.txt; echo c > "c with spaces.txt" $ > 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