麻烦各位,帮忙看一下。

麻烦各位,帮忙看一下。

想创建一个简单的菜单:
#!/bin/bash
#menu
USERNAME=`whoami`
HOSTNAME=`hostname -s`
DATE=`date +%d/%m/%Y`
while :
do
  tput clear
#here documents starts here
cat <<cs
----------------------------------------------------------
UserUSERNAME          HostHOSTNAME          DateDATE
----------------------------------------------------------
                1 : List files in current directory
                2 : Use the vi editor
                3 : See who is on the system
                H : Help screen
                Q : Exit Menu
-----------------------------------------------------------
cs
#here document finished
echo -e -n "\tYour choice[1,2,3,H,Q]:"
read CHOICE
  case $CHOICE in
   1) ls ;;
   2) vi ;;
   3) who ;;
h|H) cat <<cs
      This is the help screen,nothing here yet to help you!
cs ;;
q|Q) exit 0 ;;
   *) echo -e "\t\007unkown user response" ;;
  esac
echo -e -n "\tHit the return key to continue"
done
但运行时会报错:
/root/bin/menu: line 36: syntax error: unexpected end of file
帮忙看一下,问题出在哪里,谢了!      
那三个表情符号是     :$      
复制内容到剪贴板
代码:
#!/bin/bash
#menu
USERNAME=`whoami`
HOSTNAME=`hostname -s`
DATE=`date +%d/%m/%Y`
while :
do
  tput clear
#here documents starts here
cat <<cs
----------------------------------------------------------
User $USERNAME          Host $HOSTNAME          Date $DATE
----------------------------------------------------------
                1 : List files in current directory
                2 : Use the vi editor
                3 : See who is on the system
                H : Help screen
                Q : Exit Menu
-----------------------------------------------------------
cs
#here document finished
echo -e -n "\tYour choice[1,2,3,H,Q]:"
read CHOICE
case $CHOICE in
   1) ls ;;
   2) vi ;;
   3) who ;;
   h|H) cat <<cs
      This is the help screen,nothing here yet to help you!
cs
   ;;
   q|Q) exit 0 ;;
   *) echo -e "\t\007unkown user response" ;;
  esac

echo -e -n "\tHit the return key to continue"
done
      
楼主可以参考一下select菜单
复制内容到剪贴板
代码:
#! /bin/bash

PS3="SELECT A PROGRAM TO EXECUTE
: "
select program in 'ls -F' pwd date exit
do
        $program
#       break
done
      
#!/bin/bash
#menu
USERNAME=`whoami`
HOSTNAME=`hostname -s`
DATE=`date +%d/%m/%Y`
while :
do
   #clear
#here documents starts here
cat <<cs
----------------------------------------------------------
User$USERNAME          Host$HOSTNAME          Date$DATE
----------------------------------------------------------
                1 : List files in current directory
                2 : Use the vi editor
                3 : See who is on the system
                H : Help screen
                Q : Exit Menu
-----------------------------------------------------------
cs
#here document finished
echo -e -n "\tYour choice[1,2,3,H,Q]:"
read CHOICE
  case $CHOICE in
   1) ls  
          continue;;
   2) vi
         continue;;
   3) who
         continue;;
h|H) echo " This is the help screen,nothing here yet to help you!"
         continue;;
q|Q) exit 0
         ;;
   *) echo -e "\t\007unkown user response" break;;
  esac
echo -e -n "\tHit the return key to continue"
done
是while循环的问题  加上continue就了  
但最好别加clear 否则在显示之前就退出了      
呵呵,谢了!      
好像又看见两个新面孔, 欢迎到 shell 版来做客

To 楼主: 以后发贴请突出主题      
值得学习!学习!学习!