我才学shell,可是按照书上的一个简单的小程序也出错,找了半天也没找出问题,帮我看下啊!这是原代码:
#!/bin/bash
#This program is used to study if then
#VBird 2002/06/27
echo "press 'y' to contiue"
read yn
if ["$yn" = "y"];then
echo "script is running..."
else
echo "stop!"
fi
下面是执行后的错误提示:
[root@localhost test]# sh test06-ifthen.sh
press 'y' to contiue
y
test06-ifthen.sh: line 6: [y: command not found
stop!
帮我看看错误啊
#!/bin/bash
#This program is used to study if then
#VBird 2002/06/27
echo "press 'y' to contiue"
read yn
if [ "$yn" = "y" ];then #[空格"$yn"空格=空格"y"空格]
echo "script is running..."
else
echo "stop!"
fi