home | list info | list archive | date index | thread index

Re: [OCLUG-Tech] is "xargs" really still useful just for limiting command line size?

  • Subject: Re: [OCLUG-Tech] is "xargs" really still useful just for limiting command line size?
  • From: Alex Pilon <alp [ at ] alexpilon [ dot ] ca>
  • Date: Fri, 16 Mar 2018 11:14:30 -0400
> On Fri, 16 Mar 2018, James wrote:
> > It is necessary for running a command on all files matching a
> > pattern.
>
On Fri, Mar 16, 2018 at 11:04:30AM -0400, Robert P. J. Day wrote:
>   i'm pretty sure that's not true.
>
> […]
>
>   $ echo /* | wc -c
>   119
>   $ echo /*/* | wc -c
>   159988
>   $ echo /*/*/* | wc -c
>   688989
>   $ echo /*/*/*/* | wc -c
>   3882671

It is. In the examples above you're likely inadvertently using a shell
builtin, rather than an external process. Try /usr/bin/echo.

> > Wildcarding substitutes the full file names of each matching result
> > of the wildcard on the command line. Thousands of matching
> > names/paths can easily blow up the buffer.
>
>   but that's the very point i was making ... that once upon a time,
> there was limited space to construct a command before running it but,
> these days, that limit is clearly much larger.

Still not large enough.

> i'm fairly sure i can conclude that a command can be at least 3882671
> characters long, can i not?

Let's distinguish between commands and external processes. The former
one is something to look into further.

Regards,

Alex Pilon