分页: 1 / 1

求解。

发表于 : 2009-07-21 20:56
bengtom
本人是新手,刚看完书作个例子,可就是错误。。求解。求原因。

脚本如下:
#!/bin/bash
#if then 用法。


echo "Please press y to continue!"
read YN
if ["$YN"="y"] || ["$YN"="Y"] ; then
echo "running"
else
echo "stop!"
fi

但当我输入y or Y enter的时候出现:
/home/beng/test/test-if.sh: 11: [y=y]: not found
/home/beng/test/test-if.sh: 11: [y=Y]: not found
stop!


请问为什么哦。

Re: 求解。

发表于 : 2009-07-21 21:00
BigSnake.NET
[ "$YN" = "y" ]

Re: 求解。

发表于 : 2009-07-22 12:56
bones7456
注意空格