免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2659 | 回复: 0
打印 上一主题 下一主题

centos shell脚本问题"syntax error: unexpected end of file" [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-12-03 23:55 |只看该作者 |倒序浏览
#!/bin/bash
#menu
#set the date,user and hostname up

MYDATE=`date +%d/%m/%Y`
THIS_HOST=`hostname -s`
USER=`whoami`

#loop forever !
while :
do
        #clear the screen
        clear
        #here documents starts here
        cat <<-MAYDAY
        ----------------------------------------------------------
        User: $USER          Host: $ THIS_HOST         DATE : $MYDATE
        ----------------------------------------------------------
           1:List files in current directory
           2:Use the vi editor
           3:See who is on the system
           H:Help screen
           Q:Exit Menu   
        ----------------------------------------------------------
        MAYDAY

        #here document finished
        echo -e -n "\tEnter Your Choice [1,2,3,H,Q] >"
        read CHOICE
        case $CHOICE in
                1) ls
                          ;;
                  2) vi
                          ;;
                  3) who
                          ;;
                  H|h)
                        #use a here document for the help screen
                          cat <<-MAYDAY #将以下3行注释掉就不会报错
                          This is the help screen,nothing here yet to help you!
                          MAYDAY
                          ;;
                  Q|q) exit 0
                          ;;
                  *) echo -e "\t\007unknown user response"
                          ;;
          esac
          echo -e -n "\tHit the return key to continue"
          read DUMMY
done

cat <<-MAYDAY这三行应如何修正呢?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP