I have to confess: your problem is very challenging. I never thought about programming such thing...
But I went home, started Linux (I do most of my posts from Windows, at college), read 'man bash', and here's the code I could write for you:
8<---------- cut here
#!/bin/bash
# Valter Ferraz Sanches <vfs@mail.com>
NAME=([0]="John" [1]="Mary" [2]="Fred")
SURNAME=([0]="Doe" [1]="Poppins" [2]="Flintstone")
# this gets args from command line and add them to the arrays.
# it's NOT the Right Thing, but can give you a brief idea of what to do
# You may add options, like -name "list" -surname "list" to parse the
# correct elements and insert them in the appropriated array.
for i in $@
do
# this ugly stuff inside brackets counts the number of elements
# so every new element added increases array counter.
NAME[${#NAME[@]}]=$i
SURNAME[${#SURNAME[@]}]=$i
done
# starts loop at element 0 and stops at last.
for ((i=0; i < ${#NAME[@]}; i++))
do
# echo element number, name and surname.
echo "Howdy #$i: ${NAME[$i]} ${SURNAME[$i]}"
done
# HTH, vfs
--------------cut here >8
Cheers,
vfs