6

I was reading the Linux man page for xargs recently, and it appears that the -i option is deprecated. To quote from the documentation:

    -i[replace-str], --replace[=replace-str]
          This option is a synonym for -Ireplace-str if replace-str is
          specified.  If the replace-str argument is missing, the effect
          is the same as -I{}.  This option is deprecated; use -I
          instead.

Just curious, why is it deprecated? What's the reason to use the more verbose -I{} syntax instead?

3
  • 1
    Presumably because POSIX xargs doesn't have -i, but it does have -I, and the extra functionality is not that great.
    – muru
    Feb 19, 2016 at 19:40
  • you would have to ask on the xarg development mailing list.
    – Panther
    Feb 19, 2016 at 19:40
  • 1
    This logic sounds backwards. Deprecating something that follows good conventions (lower case, + long option) because some other version uses bad conventions (upper case, no long option). Is the long option deprecated? Jan 10, 2017 at 1:54

1 Answer 1

6

muru is right, if you check findutil changelog @line 1645

  • Major changes in release 4.2.9, 2004-12-05

xargs now supports the POSIX options -E, -I and -L. These are synonyms for the existing options -e, -i and -l, but the latter three are now deprecated.

There's an explanation in the man page too, see the -l option:

The -l option is deprecated since the POSIX standard specifies -L instead.

and also further down:

 The -l and -i options appear in the 1997 version of the POSIX
 standard, but do not appear in the 2004 version of the standard.
 Therefore you should use -L and -I instead, respectively.
2
  • 1
    As a pre-2004 Unix user, this change always seemed so arbitrary to me. I think this explains why I mostly stopped using xargs and switched to parallel. I tend to obey deprecation warnings, and GNU Parallel doesn't have to be told to use {} as a replacement string—in other words, its default behavior is the same as the old xargs -i behavior that I was used to. Mar 18, 2019 at 17:40
  • I guess the question should instead be: what persuaded the POSIX consortium to abandon the shorthand in favor of forcing users to be more verbose? It doesn't make sense. From this layperson's perspective, it seems like another case of idealism outweighing pragmatism in standards development. Sep 11, 2019 at 22:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.