#1
Probably the last place to go, but hey, worth a shot

I am currently doing a project in bash script and I have a question about referencing an array.

What I want to do is put a reference of an array as an element in an array. This is obviously done in C++ with * and perl with \

For example : Perl :
@base3 = ('S', 1, 3, 3, \@L1, \@R1);
and L1 and R1 are obviously predefined arrays

Now with Bash... I want to do exactly the same thing, but I can't find out how to do it. Been searching for the last 30 minutes and came up with nothing.

Here is basically the same exact thing, except in Bash now:
base3=( "S" 2 20 10 [4]=${L1[@]} [5]=${R1} )

But with this, it will just list all the elements, which is obviously not what I want to do ( This is going to be a recursive problem where I am going to send the array elements as parameters, so accessing them as easily as possible would be fantastic)

If it is impossible, then all right, but I was wondering if any experienced programmers here in the Pit can help me out.

Thanks
#3
have you looked up on the net for guides on arrays? there is bound to be a helpful one around somewhere
Quote by musical donkey
cyclobs you are demented..... in a good way
#5
Quote by cyclobs
have you looked up on the net for guides on arrays? there is bound to be a helpful one around somewhere


Of course. I have been searching through references and tutorials and example programs for quite a bit now. I know it can be done in C++ and what not, I just don't want to stop at the conclusion it is not possible in Bash, and that is where I am at right now.

I guess I don't understand if it can be done in Perl, why not bash?

If anyone knows what I am talking about....

>.<
#6
well as far as i know you can near write a whole program with bash scripting so i don't see why you can't.


i dout you would find programmers here tho. you could try on your distibutions' forums or ubuntu forums if you use that.

i don't really understand much about arrays since i haven't gotten that far in programming >.<


EDIT: also don't forget bash scripting is just batch script except the ability to use many programming elements
Quote by musical donkey
cyclobs you are demented..... in a good way
Last edited by cyclobs at Oct 12, 2008,