[NTLUG:Discuss] Simple bash shell question

. Daniel xdesign at hotmail.com
Fri Mar 30 16:27:29 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
>
Also a very creative implementation.  Noted for future reference!

But when I'm ready, this will be a Nautilus script and anything that 
currently references the likes of *.mpg will become something like "cat 
$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" which shouldn't, in theory, break 
bash's expansion buffer since there's no expansion going on.

_________________________________________________________________
冒険野郎バディ先生、セクシー計算先生、ビリー・ゲイツ先生など個性的な教師陣が
大活躍 http://goldenmesse.jp/ 




More information about the Discuss mailing list