Re: Re: ls and rm: "argument list too long"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Robert Nichols wrote:

These shouldn't make any difference. The limit is on the size of the expanded shell command line.

Really?

$ M=0; N=0; for W in `find /usr -xdev 2>/dev/null`; do M=$(($M+1)); N=$(($N+${#W}+1)); done; echo $M $N
156304 7677373

vs.

$ /bin/echo `find /usr -xdev 2>/dev/null`
bash: /bin/echo: Argument list too long

For the first case, the shell never tries to pass the list as command arguments. It builds the list internally, limited only by memory size, and processes the
words one by one.

Is that peculiar to bash? I thought the `command` construct was expanded by shells into the command line before being evaluated.


--
  Les Mikesell
   lesmikesell@xxxxxxxxx
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux