Re: Is there array of array in bash?

On Tue, 01 Jul 2008 19:55:53 -0300, PengYu.UT@xxxxxxxxx <PengYu.UT@xxxxxxxxx> wrote:


I'm trying to use an array of array in bash in the following script.
It is not working. Is there a way to make it work?


$cat ./

coordinates=((0 0) (1 1))

for c in $coordinates[*];
echo $c

$ ./
./ line 3: syntax error near unexpected token `('
./ line 3: `coordinates=((0 0) (1 1))'

$ coordinates=(0 1 2 3)
$ for c in ${coordinates[*]};do echo $c;done

Relevant Pages

  • Re: Referencing Korn Shell Array Names as a Variable
    ... Your idea worked for displaying the output from the command. ... $ echo $ ... # Attempt to use variable array name and index to reference array value ... The issue is with this line of the script ...
  • Re: array problem: space between words
    ... last_arr_member# FUNCTION to echo the amount of members an array contains ... can be used to append an element to the array. ... Removing my 'echo', and your 'eval', this is the quickest way for bash I can think of by now. ... Yes, I use command substitution in the calling functions, to do things like reverse iterating and array. ...
  • Re: Logon script - function array and select case not working
    ... this all works well, except, the function i am using for the rules in the control script causes alot of querrys to AD. as there are alot of groups. ... objTSout.writeline retrv ... So if you think that this will assign an array value to the variable, how do you think the case select statement is going go compare this array value with the literal string values such as "group name here"? ... However, by not assigning ANY value to checkgrp in the function, you are guaranteeing that, should the function ever exit, it will return no information. ...
  • Re: Perl: Subroutines and use of the "GD::Graph::bars;" Module
    ... I have been looking at the script once again, I could not really get your suggestion to work, but I have been doing some new changes thought. ... @array = sort @array; ... sub verbose { ... Global symbol "$title" requires explicit package name at ./ line 53. ...
  • Re: Field splitting: Is the default IFS treated differently?
    ... I've run across another oddity of this sort in bash. ... While fiddling with a script to read a file into an array with a single ... According to the bash man page, command substitution removes trailing ...