Limits of length for the expansion of * in Bash?

六眼飞鱼酱① 提交于 2019-12-18 06:12:47

问题


In Bash

echo *

is almost equivalent to ls.

You can do things like

echo */*-out/*.html > all-my-html-files-on-one-line

Since * is a command line argument then there should be a limit on the length.

What is that limit?

Is the limit different between echo the Bash command and /bin/echo the program?


回答1:


The shell does not limit this

You can see the limit for your system with (run on my 64bit linux:)

$ getconf ARG_MAX
2097152

See this very informational page http://www.in-ulm.de/~mascheck/various/argmax/




回答2:


I believe the command line limit is the value of ARG_MAX which you can see with

getconf ARG_MAX

This is not a bash variable, which would suggest that the limit is the same for echo in bash and /bin/echo.



来源:https://stackoverflow.com/questions/6461227/limits-of-length-for-the-expansion-of-in-bash

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!