簡體   English   中英

linux命令xargs:它傳遞的參數的最大大小?

[英]linux command xargs: maximum size of the arguments passed by it?

似乎xargs沒有立刻傳遞所有參數,在手冊中說xargs executes the command (default is /bin/echo) one or more times ,我聽說這是因為xargs剁了傳遞在參數組中,並按組將它們傳遞給命令組。 如果這是正確的,任何人都知道如何確定這個組的大小? 謝謝

使用--show-limits參數。 它將列出您系統的現有限制。

$ xargs --show-limits
Your environment variables take up 4108 bytes
POSIX upper limit on argument length (this system): 2090996
POSIX smallest allowable upper limit on argument length (all systems): 4096
Maximum length of command we could actually use: 2086888
Size of command buffer we are actually using: 131072

組大小取決於傳入的每個參數的長度和上面列出的限制。

xargs手冊頁,供參考:

POSIX標准允許實現限制exec函數的參數大小。 此限制可能低至4096字節,包括環境的大小。 要使腳本可移植,它們不能依賴更大的值。 但是,我知道沒有實施,其實際限制很小。 --show-limits選項可用於發現當前系統的實際有效限制。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM