>Could someone guide me around bash's lack of support for >multi-dimensional arrays? I've tried creating one array with the name >of the other arrys. Here is a sample of what I'm trying to do: >#!/bin/sh > >SERVER="MACSERVER ADVMKT CIRFIN OPSHR MIS1" > >MACSERVER="1 2 3 4 5" >ADVMKT="6 7 8 9 10" >CIRFIN="11 12 13 14 15" >OPSHR="16 17 18 19 20" >MIS1="21 22 23 24 25" > >for SYSTEM in ${SERVER} >do > echo "System: "${SYSTEM} > for ITEM in ${SYSTEM} > do > echo "Item: "${ITEM} > done >done
The "for ITEM" loop is iterating over the (single) value In bash this is easy --- use "indirect expansion":
for ITEM in ${!SYSTEM}
Ken Pizzini