23 августа 2012 г.

Bash Меню

Как-то мне захотелось оптимизировать мою работу в bash Делаем так: Открываем файл .profile в каталоге /home/XXX и дописываем туда следующее:

 trap 'echo "you typed ctrl/c"; ' INT
while true
   do  clear
echo "           OOO "Overlink"                      "
echo "  =================================            "
echo "  |                      < < IPFW |            "
echo "  |  1) Show                      |            "
echo "  |  2) Reset                     |            "
echo "  |  3) Edit                      |            "
echo "  |  4) Apply                     |            "
echo "  |                               |            "
echo "  --------------------------------             "
echo "  |                               |            "
echo "  |                       < < VPN |            "
echo "  | 5) Add users                 |            "
echo "  | 6) Restart vpn server         |            "
echo "  |                               |            "
echo "  --------------------------------             "
echo "  |                               |            "
echo "  |                     < < PPPoE |            "
echo "  |  7) Disconnect                |            "
echo "  |  8) Connect                   |            "
echo "  |                               |            "
echo "  --------------------------------             "
echo "  |  9) Exit                      |            "
echo "  |  10) ifconfig                 |            "
echo "  =================================            "


read comm


if [ $comm -eq 1 ] ; then
  clear
  sudo ipfw sh
echo ""
echo "----------------------------------------"
echo "please enter to continue"
echo "----------------------------------------"

fi


if [ $comm -eq 2 ] ; then
  clear
  sudo ipfw -q flush
echo ""
echo "----------------------------------------"
echo "please enter to continue"
echo "----------------------------------------"

fi

       read response
       case "$response" in
       "done")     break
             ;;
       "")   
             continue
       esac
   done