免费注册 查看新帖 |

Chinaunix

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

我的这个程序为什么不能运行? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-08-01 01:04 |只看该作者 |倒序浏览
环境:SCOUNIX 5.05 +KSH
程序如下:
print " COMMAND MENU "
PS3="Enter your selection:"
select choice in "Date and Time""Users Logged in""Working Directory""Files""Exit Menu"
do
        case $choice in
        "Date and Time"
        date
        ;;
        "User Logged in"
        who
        ;;
        "Working Directory)
        pwd
        ;;
        "Files"
        fc
        ;;
        "Exit Menu"
        exit
        ;;
        *)
        print "select menuREPLY is not a valid choice"
esac
done

是不是KSH里没有SELECT这个语句?

论坛徽章:
0
2 [报告]
发表于 2003-08-01 06:48 |只看该作者

我的这个程序为什么不能运行?

没有。

论坛徽章:
0
3 [报告]
发表于 2003-08-01 12:33 |只看该作者

我的这个程序为什么不能运行?

论坛徽章:
0
4 [报告]
发表于 2003-08-02 07:51 |只看该作者

我的这个程序为什么不能运行?

我手头没有 unix 的工作环境,我看出 "Working Directory"  没有右边的双引号。
ksh 中有 select 命令。

论坛徽章:
0
5 [报告]
发表于 2003-08-02 12:02 |只看该作者

我的这个程序为什么不能运行?

rooting所说的。
另外
"Date and Time""Users Logged in""Working Directory""Files""Exit Menu"
这些项之间要有空格.

"User Logged in"  与上面的select中的项不对应.少了一个s

论坛徽章:
0
6 [报告]
发表于 2003-08-02 20:33 |只看该作者

我的这个程序为什么不能运行?

为了避免记忆那麽多选项,好向可做一个1.xxx2.xxx3.xxx的菜单界面,case in 也方便点。

论坛徽章:
0
7 [报告]
发表于 2003-08-03 15:45 |只看该作者

我的这个程序为什么不能运行?

[quote]原帖由 "grljt"]为了避免记忆那麽多选项,好向可做一个1.xxx2.xxx3.xxx的菜单界面,case in 也方便点。[/quote 发表:
     
  1. cat<<!
  2. 1,xxx        2,xxx,3,xxx
  3. !
  4. read input?"please input your choice:"
  5. case $input in
  6. 1)        ....;;
  7. 2)        ....;;
  8. 3)        ....;;
  9. *)        echo "wrong...";;
  10. esac
复制代码
这样的结构比较简单明了,;)
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP