[CentOS] Re: ls and rm: "argument list too long"
Les Mikesell
lesmikesell at gmail.com
Sat Oct 18 04:52:00 UTC 2008
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 at gmail.com
More information about the CentOS
mailing list