全部博文(362)
分类:
2009-10-29 16:02:31
zhengsenlin8882009-11-10 16:37:52
你的shell脚本也可以啊。 [root@localhost ~]# vi a.sh #!/bin/sh echo "is it morning? please answer yes or no." read action case $action in yes)echo "good morning";; no)echo "good afternoon";; esac [root@localhost ~]# chmod 777 a.sh [root@localhost ~]# ./a.sh is it morning? please answer yes or no. yes good morning [root@localhost ~]# ./a.sh is it morning? please answer yes or no. no good afternoon [root@localhost ~]#
chinaunix网友2009-11-07 17:08:05
我试了试 好像不行 下面是我编的 用的是case没你的考虑周全 #!/bin/sh echo "is it morning? please answer yes or no." read action case $action in yes)echo "good morning";; no)echo "good afternoon";; esac