Re: Create variable named variable$i in for loop

From: Ed Morton (mortonAVOIDINGSPAM_at_Lucent.com)
Date: 09/25/03


Date: Thu, 25 Sep 2003 10:06:37 -0500


On 9/24/2003 9:06 PM, greyfell@zerobyte.org wrote:
> Forgive me, but shellscripts are rather new to me. I can
> create and manipulate arrays in C++ and Java, but I wouldn't know
> where to begin to do it with a shellscript. Is it even remotely
> similar?

Yes, see below (and please don't top-post!).

> On Wed, 24 Sep 2003 23:10:12 GMT, Barry Margolin
> <barry.margolin@level3.com> wrote:
>
>
>>In article <j464nvo9suecu03qs2o76b2ps8t9he4h0b@4ax.com>,
>><greyfell@zerobyte.org> wrote:
>>
>>> I'm obviously missing something. I have written a simple
>>>shellscript that performs a number of tests in a for loop. In each
>>>instance, I would like to log a count of how many successes the test
>>>encountered to then echo at the end. I'm doing it this way:
>>
>>This is what arrays are for.
>>
>>But if you really want to do what you tried to write, use "eval":
>>
>>eval sucess$i=$success
>
>

successes[$i]=$success