[NTLUG:Discuss] Simple bash shell question

Patrick R. Michaud pmichaud at pobox.com
Fri Mar 30 16:19:00 CDT 2007


On Fri, Mar 30, 2007 at 04:04:19PM -0500, Robert Citek wrote:
> . Daniel wrote:
> > So, count first, then process, all the while echoing the progress values to 
> > zenity so I can see how far along it has gone.  Crazy right?
> 
> If all you want to do is count the number of files:
> 
> fcount=$(ls *.mpg | wc -l)
> 
> Just be aware that for large number of *.mpg files you'll exceed bash's
> expansion buffer.

To avoid exceeding bash's buffer:

    fcount=$(find . -name '*.mpg' | wc -l)

Pm



More information about the Discuss mailing list