LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 768|回复: 2

求教:一个linuxshell编程题

[复制链接]
发表于 2005-11-14 21:29:38 | 显示全部楼层 |阅读模式
编写一个shell程序,设计如下的菜单,并实现其功能。
----------------------------------------------------------
  User:xxxx      Host:xxxx   Date: xx/xx/xxxx
-----------------------------------------------------------
         1.List files in current directoy
         2.Display current time
         3.See who is on system
         4.find files have been accessed during 24hours
         Q.Exit  
-----------------------------------------------------------
         Your Choice[1,2,3,4,Q]
发表于 2005-11-14 21:52:32 | 显示全部楼层
#!/bin/sh
user=$(who am i)
host=$(hostname)
date=$(date +H%+D%)
echo "------------------------------------------
useruser  Hosthost datedate
---------------------------------------------------"
echo  
1.List files in current directoy
2.Display current time
3.See who is on system
4.find files have been accessed during 24hours
Q.Exit
---------------------------------------------------------
read choose
case "$choose"
     in

1)command;;
2)command2;;
3)command 3;;
4)command4;;
q|Q)exit 0;;
*)echo "usage some error";;
用printf会好一些
esac
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-11-14 22:13:12 | 显示全部楼层
command能不能具体点,谢啦
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表