D. Cooper Stevenson wrote:
> Hi All,
>
> This seemingly simple question has had me perplexed since last night. I
> want to index an array by a loop counter variable, for example:
>
>   for (( column=1; column < ( num_of_iterations + 1); column++ ))
>   {
>       min_value[i]=$(code creating min_value)
>       print "column_min: " ${min_value[i]}
>   }
>
> Easy enough. The print statement works and everything's fine.
>
> However, if I say:
>
>   print "column_min: " ${min_value[2]}
>
> The variable is empty!
>
> Even worse, as soon as I drop out of the 'for' loop, KSH seems to forget
> the variable even existed. For example, just outside of the braketed
> code above, suppose I wrote:
>
>   for (( x=1; x < ( num_of_iterations + 1 ); x++ ))
>   {
>          print ${min_value[x]}
>   }
>
> KSH has no idea what I'm talking about; it's as if $min_value[] has
> simply vanished.
>
> How can I create arrayed KSH variables that "stick?"
>
>
> Very Best,
>
>
> D. Cooper Stevenson
>   
D. Cooper Stevenson
A question, if I may ... in the first snip ... where does the index 
variable 'i' come from and how is it incremented?
Regards
Fred James

_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to