shell编程的小问题,if语句报错
#!/bin/bashecho-n"enteryourchose:"readxif["${x}"=="0"]thenecho1elseecho2fi[root@local...
#!/bin/bash
echo -n "enter your chose:"
read x
if ["${x}" == "0" ]
then
echo 1
else
echo 2
fi
[root@localhost home]# ./if1.sh
enter your chose:0
./if1.sh: line 4: [0: command not found
2
[root@localhost home]#
这什么意思啊,我错那了? 展开
echo -n "enter your chose:"
read x
if ["${x}" == "0" ]
then
echo 1
else
echo 2
fi
[root@localhost home]# ./if1.sh
enter your chose:0
./if1.sh: line 4: [0: command not found
2
[root@localhost home]#
这什么意思啊,我错那了? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询