KSH isn't my strong suit but it's what my company has to offer. I've got a script with two nested loops, a FOR and UNTIL, and that works fine. When I add a CASE into the mix I end up getting "Unexpected 'done' at line xx" errors. Any suggestions on this?
for divi in at ce ci cm co de di fl fr jc ks lo mi ma qf ra sm ho da sw;do
typeset -Z3 store
store=1
until [[ $store -eq 999 ]];do
nslookup moxa1.$divi$store.company.com 2> /dev/null | sed -n '4,5p' >> ~/moxas
if $store = 999 then
case $divi in
"at")
echo "NAME=CE001 CENTRAL ----------; CT=TELNET; IP=1.1.1.1" >> ~/moxas
;;
"ce")
echo "NAME=CI001 CINCINNATI ----------; CT=TELNET; IP=1.1.1.1" >> ~/moxas
;;
"ci")
esac
((store=store+1))
done
done
The CASE statement actually has 18 options but I cut them out here for brevity.