shell寫的控制選單

zhyuh發表於2004-09-10
寫了上面的自動倒入資料的指令碼後,
根據需要又寫了這個選單介面,方便使用者使用。
寫這個shell的時候參照了一個高人的例子,
放在這裡只為了方便自己日後用到時可以參考一下
[@more@]
#!/bin/ksh
pop_profile()
{
sqlplus -s zjenn/zjenn>>/dev/null<  execute p_analytic.con2profile;
  exit;
EOF
}
pop_behavior()
{
sqlplus -s zjenn/zjenn>>/dev/null<  execute p_analytic.con2behavior;
  exit;
EOF
}
pop_putch()
{
sqlplus -s zjenn/zjenn>>/dev/null<  execute p_analytic.con2putch;
  exit;
EOF
}
pop_ecomm()
{
sqlplus -s zjenn/zjenn>>/dev/null<  execute p_analytic.con2ecommerce;
  exit;
EOF
}
pop_src()
{
sqlplus -s zjenn/zjenn>>/dev/null<  execute p_analytic.con2src;
  exit;
EOF
}
pop_rfm()
{
sqlplus -s zjenn/zjenn>>/dev/null<  execute p_analytic.con2rfm;
  exit;
EOF
}
join_ana()
{
sqlplus -s zjenn/zjenn>>/dev/null<  execute analytic2txt;
  exit
EOF
}
pop_ana_menu()
{
CHOICE='1'
while [ $CHOICE != '0' ]
do
  clear
  echo "  Populate Analytical File   "
  echo "---------------------------------------------------------"
  echo " 1. Profile "
  echo " 2. Purchase "
  echo " 3. Ecommerce "
  echo " 4. Source Count "
  echo " 5. Behavioral "
  echo " 6. RFM "
  echo " 7. Join Analytical Tables "
  echo " 8. Back to Main Menu "
  echo " 0. Exit "
  echo "----------------------------------------------------------"
  echo
  echo "Your choice: c"
  read CHOICE
if [ "x$CHOICE" == "x" ]; then
  CHOICE='x'
fi
case $CHOICE in
  1) pop_profile
     echo "nnnPress RETURN to continue..."; read DUMMY
     ;;
  2) pop_putch
     echo "nnnPress RETURN to continue..."; read DUMMY
     ;;
  3) pop_ecomm
     echo "nnnPress RETURN to continue..."; read DUMMY
     ;;
  4) pop_src
     echo "nnnPress RETURN to continue..."; read DUMMY
     ;;
  5) pop_behavior
     echo "nnnPress RETURN to continue..."; read DUMMY
     ;;
  6) pop_rfm
     echo "nnnPress RETURN to continue..."; read DUMMY
     ;;
  7) join_ana
     echo "nnnPress RETURN to continue..."; read DUMMY
     ;;
  8) main_menu
     echo "nnnPress RETURN to continue..."; read DUMMY
     ;;
esac
done
}
main_menu()
{
CHOICE='1'
while [ $CHOICE != '0' ]
do
clear
echo "            NAD Control Menu                      "
echo "----------------------------------------------------------------"
echo "1. Net.com/Promotional Registration Data Loading"
echo "2. Net.com/Production Registration Data Loading"
echo "3. Rebate Data Loading"
echo "4. Siebel Order Loading"
echo "5. Messaging Event Contact List Data Loading--DartMail"
echo "6. Messaging Event Contact List Data Loading--Xpedite"
echo "7. Messaging Event Response Data Loading"
echo "8. Data Conversion"
echo "9. Extract Contact De-dupefile to DataCo"
echo "a. DataCo contact De-deup Data Loading"
echo "b. Merge/Purge"
echo "c. Populate Analytical File"
echo "d. Extract Analytical File"
echo "e. Append demographic Data"
echo "f. Append Model Decile Values"
echo "0. Exit"
echo "-----------------------------------------------------------------"
echo
echo "Your choice: c"
read CHOICE
if [ "x$CHOICE" == "x" ]; then
  CHOICE='X'
fi
case $CHOICE in
  1) nad_load PROMOREG
     echo "nnnPress RETURN to continue..."; read DUMMY
     ;;
  2) nad_load PRODREG
     echo "nnnPress RETURN to continue..."; read DUMMY
     ;;
  3) nad_load REBATE
     echo "nnnPress RETURN to continue..."; read DUMMY
     ;;
  4) nad_load ORDER
     echo "nnnPress RETURN to continue..."; read DUMMY
     ;;
  5) nad_load DARTMAIL
     echo "nnnPress RETURN to continue..."; read DUMMY
     ;;
  6) nad_load XPEDITE
     echo "nnnPress RETURN to continue..."; read DUMMY
     ;;
  7) nad_load  EMAILRESP
     echo "nnnPress RETURN to continue..."; read DUMMY
     ;;
  8) pop_conv_menu
     echo "nnnPress RETURN to continue..."; read DUMMY
     ;;
  9) nad_dedup_con
     echo "nnnPress RETURN to continue..."; read DUMMY
     ;;
  a) nad_load DEDUP
     echo "nnnPress RETURN to continue..."; read DUMMY
     ;;
  b) 
     echo "nnnPress RETURN to continue..."; read DUMMY
     ;;
  c) pop_ana_menu
     echo "nnnPress RETURN to continue..."; read DUMMY
     ;;
  d)  nad_ana_spool
     echo "nnnPress RETURN to continue..."; read DUMMY
     ;;
  e) nad_load DEMO
     echo "nnnPress RETURN to continue..."; read DUMMY
     ;;
  f) nad_load MODEL
     echo "nnnPress RETURN to continue..."; read DUMMY
     ;;
esac
done
}
##################
# main
##################
main_menu

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/207/viewspace-778463/,如需轉載,請註明出處,否則將追究法律責任。

相關文章