Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Array
Name: Frank Date: September 9, 2002 at 01:46:00 Pacific OS: AIX 4.3.3 CPU/Ram: 450-RSIC/4GB
Comment:
Hi,
have a litel problem wiht shell variable handling: I have a ksh Array variable where the base name of the variable includes a variable itself ${Array$c[*]} I have some problems in handling of this kind of combination. e.g:
ArrayFRA[1]="frank" ArrayBIL[1]="bill" c=FRA Now I would like to use this combination: echo ${Array$c[1]}
Name: James Boothe Date: September 9, 2002 at 08:28:07 Pacific
Reply:
Can these be simple variables instead of array variables, or do you need to use slots other than [1]?
Being array variables makes this a tough problem. I tried all sorts of approaches, finally came up with the following, which pre-constructs the expression string:
ArrayFRA[1]="frank" ArrayBIL[1]="bill"
c=FRA Aexpr=\${Array$c[1]} eval echo $Aexpr
c=BIL Aexpr=\${Array$c[1]} eval echo $Aexpr
0
Response Number 2
Name: Frank Date: September 10, 2002 at 02:39:04 Pacific
Reply:
Hi James,
yes you are right this can be used as work around for this. But I am not realy satisfiyed with this. I already use this way in my scripts but it must exist another soulution. Anyway thank you very much for your effort.
Summary: Hi, Does anyone know how to set up an array in Borne Shell (please note : just Bourne Shell) ? i remember that once upon a time :) I used to use this but ... :) BTW,thank you very much to any member w...
Summary: Hi I am trying to run a loop based on an array variable. I have a function that on completion sets the COMPLETE flag to 1. The next function is called and controlled by a while loop which I've had run...
Summary: Hi Can you make an array of an array ? Example: I have the array LOTTERY_LINE[x] which contains a line of numbers like 1,2,3,4,5,6. I want to reference each number seperately - I know how to do this a...