From owner-freebsd-current@FreeBSD.ORG Fri Sep 24 00:25:09 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 44DFB16A4CE for ; Fri, 24 Sep 2004 00:25:09 +0000 (GMT) Received: from mproxy.gmail.com (rproxy.gmail.com [64.233.170.194]) by mx1.FreeBSD.org (Postfix) with ESMTP id E5BD443D4C for ; Fri, 24 Sep 2004 00:25:08 +0000 (GMT) (envelope-from juhasaarinen@gmail.com) Received: by mproxy.gmail.com with SMTP id 78so919276rnk for ; Thu, 23 Sep 2004 17:25:08 -0700 (PDT) Received: by 10.38.15.66 with SMTP id 66mr6018076rno; Thu, 23 Sep 2004 17:25:07 -0700 (PDT) Received: by 10.38.73.29 with HTTP; Thu, 23 Sep 2004 17:25:07 -0700 (PDT) Message-ID: Date: Fri, 24 Sep 2004 12:25:07 +1200 From: Juha Saarinen To: Giorgos Keramidas In-Reply-To: <20040924000313.GB27322@gothmog.gr> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <009301c4a173$d468de90$7890a8c0@gits.invalid> <20040924000313.GB27322@gothmog.gr> cc: freebsd-current@freebsd.org Subject: Re: Could ARG_MAX be increased? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Juha Saarinen List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2004 00:25:09 -0000 On Fri, 24 Sep 2004 03:03:13 +0300, Giorgos Keramidas 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