help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-bash] array indirection


From: Bill Gradwohl
Subject: [Help-bash] array indirection
Date: Fri, 4 May 2012 18:20:46 -0600

Can anyone explain why one pass of this loop works and then fails.

If it didn't work at all, or worked all the time I could understand, but working once and then quitting is confusing.

array=(11 12 13 14 15)
variableName='array'

for ((x=0; x<address@hidden; ++x)); do
   echo "array[${x}]=${!variableName[$x]}"
done
==================
Produces:
address@hidden 01.ycc# ./tst pass3
array[0]=11
./tst: line 33: !variableName[$x]: unbound variable


--
Bill Gradwohl


reply via email to

[Prev in Thread] Current Thread [Next in Thread]