Bernhard Voelker wrote: > Eric Blake wrote: > > Enda wrote: > > > $ echo cat $(ls -Qv *.pdf) > > > Why are you even bothering with ls, when the following is faster and > > does what you want, without having to worry about awkward quoting in the > > first place? > > Probably because of the -v sorting order ... so it's - once > again - a little argument for a --null option.
Or 'find' which has a -print0 option. > Otherwise, I'd suggest something like the following to avoid > the `eval` problems: > > $ ls -1v *.pdf | xargs -d$'\n' cat > > And if there are even newline characters in the file names, > then maybe this would be it: > > $ printf "%s\0" *.pdf | sort -zV | xargs -0 cat It may be the same thing but as a matter of taste I prefer 'find'. find . -maxdepth 1 -name '*.pdf' -print0 | sort -zV | xargs -0 cat Bob
