Could ARG_MAX be increased?
Juha Saarinen
juhasaarinen at gmail.com
Thu Sep 23 17:25:09 PDT 2004
On Fri, 24 Sep 2004 03:03:13 +0300, Giorgos Keramidas <keramida at linux.gr> wrote:
> The friend is correct. This is a nice trick.
>
> xargs will construct a command line by appending one or more filenames
> to what you pass. The important part being ``one or more''.
>
> If xargs appends one filename to an argument list of `grep foo', the
> executed command is `grep foo filename', which will not list the name of
> the file with every match since grep sees only 1 filename argument.
>
> If the argument list passed to xargs is `grep foo /dev/null' though, the
> executed command is `grep foo /dev/null filename'; in this case the
> filenames grep sees are always at least 2, which enables printing the
> filename with every match.
>
> This is better illustrated with an example:
>
> $ grep PS1 .bashrc
> export PS1='${USER}@\h[\A]${PWD}\$ '
> $ grep PS1 /dev/null .bashrc
> .bashrc:export PS1='${USER}@\h[\A]${PWD}\$ '
Well, learn something new every day :-)
Thanks for the explanation.
--
Juha
More information about the freebsd-current
mailing list