The UNIX and Linux Forums
>
Top Forums
>
UNIX for Advanced & Expert Users
Array inside an array
User Name
Remember Me?
Password
Google UNIX.COM
Forums
Directory
Register
Forum Rules
FAQ
Contribute
Members List
Search
Today's Posts
Mark Forums Read
Thread
:
Array inside an array
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
#
5
(
permalink
)
08-23-2007
Perderabo
Unix Daemon
Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,711
The first element of an array is 0, not 1.
var1=$srch_fld[$j]
echo "${srch_fld}(${j}) = ${!var1}"
will give you the correct indices. If you want to pretend that the first index is 1, you could use:
echo "${srch_fld}($((j+1))) = ${!var1}"
Perderabo
View Public Profile
Find all posts by Perderabo