Xargs

為什麼不推薦使用 xargs -i 選項?

  • February 19, 2016

我最近正在閱讀Linux 手冊頁xargs,看來該-i選項已被棄用。從文件中引用:

   -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.

只是好奇,為什麼它被棄用了?使用更冗長的-I{}語法的原因是什麼?

muru是對的,如果你檢查findutilchangelog @line 1645

  • 2004-12-05 版本 4.2.9 的主要變化

xargs現在支持 POSIX 選項-E和. 這些是現有選項和的同義詞,但後三個現在已棄用。-I``-L``-e``-i``-l

頁面中也有解釋man,請參閱-l選項:

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

並且進一步向下:

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.

引用自:https://unix.stackexchange.com/questions/264431