I'm trying to let the user pick the array name because the arrays are sets of domain names.
while getopts h:c: option
do
case "${option}"
in
c) client=${OPTARG};
h) usage;;
esac
done
So like I want client=one of the customer arrays
customer1=(my_custdomain.com, my_custdomain2.com...)
custmoer2=(my1_custdomain.com, my1c_custdomain2.com...)
for i in client
do
func_name
done
by now I'm really confused about expansions/quotes.
func_namewhich is passed no arguments; a list of items containing justclientthat you're iterating over with a variableithat is never used; it isn't clear what you are storing in$client(is it a digit, or the name of the array). I assume thatcustmoer2is a typo; maybe you meant to usefor i in $client. Maybe you're simply looking for the${!var}notation for indirect expansion. Maybe you need to read the Bash manual.