I have a KSH function and I have simplified the issue. If too much let me know.
funcPrintList
{
NAMELIST=$1
for NAME in $NAMELIST
do
print $NAME
done
return 0
}
#
# Array of names
#
set -A NMELIST bob jane rick sarah
#
#mainline
#
funcPrintList "${NMELIST[*]}"
exit 0
This works fine for an Array that I know the name of. However, I would like to be able to process the name dynamically, like:
set -A ABCLIST bob jane rick sarah
set -A XYZLIST jane rick sarah
set -A EFGLIST rick sarah
If I dynamically get the first 3 digits:
FIRST3="ABC"
ARRAYNAME="$FIRST3" "LIST"
Now $ARRAYNAME="ABCLIST"
However, I cannot seem to get the call to the function to work. It ends up sending the name ABCLIST instead of the array.
As always--- Thanks in advance.
funcPrintList
{
NAMELIST=$1
for NAME in $NAMELIST
do
print $NAME
done
return 0
}
#
# Array of names
#
set -A NMELIST bob jane rick sarah
#
#mainline
#
funcPrintList "${NMELIST[*]}"
exit 0
This works fine for an Array that I know the name of. However, I would like to be able to process the name dynamically, like:
set -A ABCLIST bob jane rick sarah
set -A XYZLIST jane rick sarah
set -A EFGLIST rick sarah
If I dynamically get the first 3 digits:
FIRST3="ABC"
ARRAYNAME="$FIRST3" "LIST"
Now $ARRAYNAME="ABCLIST"
However, I cannot seem to get the call to the function to work. It ends up sending the name ABCLIST instead of the array.
As always--- Thanks in advance.