linux的xargs命令的所有参数,linux命令xargs:它传递的参数的最大大小?

似乎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手册页,以供参考:

The POSIX standard allows implementations to have a limit on the size of arguments to the exec functions. This limit could be as low as 4096 bytes including the size of the environment. For scripts to be portable, they must not rely on a larger value. However, I know of no implementation whose actual limit is that small. The --show-limits option can be used to discover the actual limits in force on the current system.

这很好,谢谢。

具有讽刺意味的是,--show-limits选项不是xargs的POSIX标准的一部分,因此您不能依赖它。 (我认为这是GNU扩展。)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值