Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Oct 2004 22:26:09 +0200
From:      FreeBSD questions mailing list <FreeBSD@amadeus.demon.nl>
To:        questions@freebsd.org
Subject:   Increasing variable#
Message-ID:  <1E30D9F8-1D56-11D9-B5AA-0003939726F0@amadeus.demon.nl>

next in thread | raw e-mail | index | archive | help
Hi
I need some help with this script I'm trying to write.

This is what I have:


#!/bin/sh
Max=4
Count=1

until [ $Count -gt $Max ]
do
        A$Count=" `...something...`"
         Count=$(($Count+1))
done
exit 0


I want to put the result of "something" in a serie of variables with an 
increasing number in it's name:
A1=result_of_something
A2=result_of_something
A3=result_of_something
A4=...
etc.
until $Count > $Max

I don't know how to create such a variables serie, well, at least the 
example isn't working because the syntax A$Count generates an error and 
I have no idea what it should be.
I don't know how to search for such a topic...

Can anyone tell me how this should be handled?

thanks in advance,
Arno



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1E30D9F8-1D56-11D9-B5AA-0003939726F0>