"Fossies" - the Fresh Open Source Software Archive

Member "splitvt-1.6.6/examples/menu" (1 Apr 2007, 1032 Bytes) of package /linux/misc/old/splitvt-1.6.6.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/sh
    2 #
    3 #   An example menu utilizing the SPLITVT environment variable.
    4 #
    5 
    6 # Portably echo a line with no trailing newline:
    7 echo_n() {
    8     if [ "`echo -n \"\"`" = "" ]; then
    9         echo -n "$*"
   10     elif [ "`echo -e \"\\c\"`" == "" ]; then
   11         echo -e "$*\c"
   12     else 
   13         echo "$*\c"
   14     fi
   15 }
   16 
   17 if [ "$SPLITVT" = "upper" ]; then
   18     echo "This is the upper window MENU:"
   19     echo ""
   20     echo "1)    apples"
   21     echo "2)    oranges"
   22     echo "3)    bananas"
   23     echo ""
   24     echo_n "Enter your fruit of choice: "
   25     read fruit
   26     case $fruit in
   27         1)  echo "You like apples!";;
   28         2)  echo "You like oranges!";;
   29         3)  echo "You like bananas!";;
   30         *) echo "What fruit was that?";;
   31     esac
   32 elif [ "$SPLITVT" = "lower" ]; then
   33     echo "This is the lower window MENU:"
   34     echo ""
   35     echo "1)    pickles"
   36     echo "2)    carrots"
   37     echo "3)    cabbage"
   38     echo ""
   39     echo_n "Enter your vegetable of choice: "
   40     read fruit
   41     case $fruit in
   42         1)  echo "You like pickles!";;
   43         2)  echo "You like carrots!";;
   44         3)  echo "You like cabbage!";;
   45         *) echo "What vegetable was that?";;
   46     esac
   47 else
   48     echo "You are not running splitvt!"
   49 fi