Sujet : Re: IFS=$'\n'
De : naddy (at) *nospam* mips.inka.de (Christian Weisgerber)
Groupes : comp.unix.shellDate : 14. Aug 2024, 15:59:39
Autres entêtes
Message-ID : <slrnvbpe2b.20ve.naddy@lorvorc.mips.inka.de>
References : 1 2 3
User-Agent : slrn/1.0.3 (FreeBSD)
On 2024-08-13, Ralf Damaschke <
rwspam@gmx.de> wrote:
find . -iname \*fred\* -type f -print0 |
xargs -0 -r -x -- ls -lt --
>
OK, print0 is going to become standard, but nowadays I already prefer
(when I use iname for my comfort)
>
find . -iname \*fred\* -type f -exec ls -lt -- {} +
If sufficiently many files accrue, find(1) will invoke ls(1) several
times, which will not produce the expected result. That may be
unlikely in this specific example, but it can happen in the general
case.
Wait, you say, xargs(1) will also split its input across multiple
invocations. I mean, that's very much the point of xargs. Which
is why Helmut added the -x flag, which is supposed to prevent this
behavior.
On BSD, that will be a syntax error because -x is only available
in combination with -n.
-- Christian "naddy" Weisgerber naddy@mips.inka.de