Jeff Abrahamson on 19 May 2005 17:32:21 -0000

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

[PLUG] bash, double for

I want to do the following in bash.  I don't see an easy way.  (I see
very complicated ways.)  Anyone see an easy way?

    for((n=0; n<10; n++)) and $array; do 
        echo Element $n of array is $array[$n]

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.

This seems to come up for me often.



 Jeff Abrahamson  <>    +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         --
Announcements -
General Discussion  --