xargs -x (was: IFS=$'\n')

Liste des GroupesRevenir à cu shell 
Sujet : xargs -x (was: IFS=$'\n')
De : geoff (at) *nospam* clare.See-My-Signature.invalid (Geoff Clare)
Groupes : comp.unix.shell
Date : 15. Aug 2024, 13:53:04
Autres entêtes
Message-ID : <gaa1pk-lia.ln1@ID-313840.user.individual.net>
References : 1 2 3 4
User-Agent : Pan/0.154 (Izium; 517acf4)
Christian Weisgerber wrote:

On 2024-08-13, Ralf Damaschke <rwspam@gmx.de> wrote:
 
    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.

It isn't supposed to do that, and it doesn't.

$ echo 1234567890 1234567890 | xargs -s 50 echo
1234567890 1234567890
$ echo 1234567890 1234567890 | xargs -s 20 echo
1234567890
1234567890
$ echo 1234567890 1234567890 | xargs -x -s 20 echo
1234567890
1234567890

Tested with GNU, macOS (with -n 10 added), and Solaris versions of xargs.

--
Geoff Clare <netnews@gclare.org.uk>

Date Sujet#  Auteur
13 Aug 24 * IFS=$'\n'8Lawrence D'Oliveiro
13 Aug 24 `* Re: IFS=$'\n'7Helmut Waitzmann
13 Aug 24  `* Re: IFS=$'\n'6Ralf Damaschke
14 Aug 24   +- Re: IFS=$'\n'1Lawrence D'Oliveiro
14 Aug 24   `* Re: IFS=$'\n'4Christian Weisgerber
15 Aug 24    +* Re: IFS=$'\n'2Ralf Damaschke
15 Aug 24    i`- Re: IFS=$'\n'1Ed Morton
15 Aug 24    `- xargs -x (was: IFS=$'\n')1Geoff Clare

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal