Hi,
I'm really new ro shell scripting (actually any kind of programming) and am pretty sure I'm making a pretty basic error here but I can't for the life of me figure it out.
What I'm trying to do is get an array working with a case statement in a KSH script. The code is as follows:
set -A zone `zoneadm list | grep -v global`
PS3="Enter choice:"
select zone_menu in ${zone
[*]} "All" "Exit"
do
case $zone_menu in
${zone[]})
print ${zone[$REPLY-1]};;
All)
print ${zone
[*]};;
Exit)
break ;;
esac
done
So far what the above does right is that it takes the list of zones on a Solaris 10 box (minus the global zone) and inputs these into an array. I've no problem generating the list od options for the case statement using the array but it seems to be imposible to get the correct output from the case selection. I can basically get the correct output from the first option, the ALL option and the Exit option but nothing else works.
Does what I say make any sense and if so, can someone please help me? It's driving me bannanas! :wall:
Thanks in advance,
Steve
---------- Post updated at 05:12 PM ---------- Previous update was at 04:31 PM ----------
I just did the following:
...
do
case $zone_menu in
${zone[$REPLY-1]})
print ${zone[$REPLY-1]};;
All)
print ${zone
[*]};;
...
I was looking right at it. :o
Steve
P.S.: Bloody Azerty keyboards!!!