linux操作系统习题(求答案)

来源:百度知道 编辑:UC知道 时间:2024/06/30 11:01:16
试编写一个脚本,显示下边的菜单:
1.Display list of all user currently logged in
2.Get help on a particular command
Press<Ctrl+D>to exit
如果选择2,脚本要接受一个命令名作为输入数据.如果没有数据输入,脚本要显示错误并推出,否则,脚本调用手册并把命令名作为参数传递过去.

echo "1:display all the users login currently"
echo "2:get help on a particular command"
echo "please you choose a num"
read num
if test $num -eq 2
then
echo "please input the command that you want to know about"
read chr
fi
case $num in
1) who;;
2) man $chr;;

esac