From: Martin Langhoff Date: Wed, 06 Jun 2007 03:58:09 GMT Subject: Re: [PATCH] Remove useless uses of cat, and replace with filename arguments or redirection Message-ID: <46a038f90706052058h1c823278o78ce0d8edce3caab@mail.gmail.com> In-Reply-To: <87sl957naf.fsf@graviton.dyn.troilus.org> On 6/6/07, Michael Poole wrote: > Stephen Rothwell writes: > > > On Tue, 05 Jun 2007 18:34:59 -0700 Josh Triplett wrote: > >> > >> -commits=$(cat ../revs | wc -l | tr -d " ") > >> +commits=$(wc -l ../revs | tr -d " ") > > > > This is not equivalent, you probably wanted: > > > > commits=$(wc -l <../revs | tr -d " ") > > Which relevant version(s) of wc do not accept filename arguments? > POSIX[1] seems to specify it. Or do you mean that there is some > subtle difference in its processing of stdin vs specified files? Josh is right. The output *is* different because it contains the filename as well. See $ wc < .gitk | tr -d " " 2177551 $ wc .gitk | tr -d " " 2177551.gitk cheers m