shell脚本的if 命令cannot found?我编写了一个非常简单的脚本/bin/basha=1b=2if [ "$a" -ne "$b"]then echo "$a is not the same as $b"fi可是在终端运行结果如下:[root@localhost Desktop]# ./bash4.sh./bash4.sh:line 7:if[ 1 -ne 2 ]
shell脚本的if 命令cannot found?我编写了一个非常简单的脚本/bin/basha=1b=2if [ "$a" -ne "$b"]then echo "$a is not the same as $b"fi可是在终端运行结果如下:[root@localhost Desktop]# ./bash4.sh./bash4.sh:line 7:if[ 1 -ne 2 ]
shell脚本的if 命令cannot found?
我编写了一个非常简单的脚本
/bin/bash
a=1
b=2
if [ "$a" -ne "$b"]
then echo "$a is not the same as $b"
fi
可是在终端运行结果如下:
[root@localhost Desktop]# ./bash4.sh
./bash4.sh:line 7:if[ 1 -ne 2 ]:command not found
./bash4.sh:line 8:syntax error near unexpected token `then'
./bash4.sh:line 8:`then'
[root@localhost Desktop]#
shell脚本的if 命令cannot found?我编写了一个非常简单的脚本/bin/basha=1b=2if [ "$a" -ne "$b"]then echo "$a is not the same as $b"fi可是在终端运行结果如下:[root@localhost Desktop]# ./bash4.sh./bash4.sh:line 7:if[ 1 -ne 2 ]
#!/bin/bash
a=1
b=2
if [ "$a" -ne "$b"]; then
echo "$a is not the same as $b"
fi
我习惯这么写 ,试试看