+ -
当前位置:首页 → 问答吧 → 进入X后的注销命令

进入X后的注销命令

时间:2011-11-07

来源:互联网

在学习shell script

以下是代码直接从鸟哥网站里复制过来的
原网址 http://vbird.dic.ksu.edu.tw/linux_basic ... php#script

代码:
#!/bin/bash
# Program:
#    This program shows the user's choice
# History:
# 2005/08/25   VBird   First release
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH

read -p "Please input (Y/N): " yn
[ "$yn" == "Y" -o "$yn" == "y" ] && echo "OK, continue" && exit 0
[ "$yn" == "N" -o "$yn" == "n" ] && echo "Oh, interrupt!" && exit 0
echo "I don't know what your choice is" && exit 0



sh sh07.sh
Please input (Y/N): d
[: 10: d: unexpected operator
[: 11: d: unexpected operator
I don't know what your choice is

以上是我运行的結果,好吧。第10行和11行有问题,但具体是什么问题啊?

作者: zhai.j   发布时间: 2011-11-07

我测试过你的d.没有问题.我是这样执行的.
代码:
chmod +x f.sh
./f.sh

自己调试一下啊
引用:
set -x
....
set +x

作者: naturalaw   发布时间: 2011-11-07