Jeff Abrahamson on 19 May 2005 22:33:04 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] bash, double for


On Thu, May 19, 2005 at 03:38:11PM -0400, Paul L. Snyder wrote:
>   [72 lines, 357 words, 2340 characters]  Top characters: eatisron
> 
> Quoting "Paul L. Snyder" <plsnyder@drexel.edu>:
> 
> > > On Thu, May 19, 2005 at 01:32:10PM -0400, Jeff Abrahamson wrote:
> > > > The variable array is space separated (so not a bash array).  I want
> > > > bash to index through it like it does with command-line args and let
> > > > me refer to each term in sequence.
> [...]
> >   foo="bar baz womble"
> >   c=0
> >   for e in $foo; do echo "$c is $e"; c=$(($c+1)); done
> 
> I've been playing around with this a bit, and here's one that's REALLY
> short and sweet.  It's not a double-for, but it's nicely flexible if
> what you really care about is indexing.

Wow, cool.  Thanks, all, for the several suggestions.  All are useful
and easy.  Paul's leaves me standing breathless.

-- 
 Jeff

 Jeff Abrahamson  <http://www.purple.com/jeff/>    +1 215/837-2287
 GPG fingerprint: 1A1A BA95 D082 A558 A276  63C6 16BF 8C4C 0D1D AE4B

Attachment: signature.asc
Description: Digital signature

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug