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 ]

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/28 00:18:49
shell脚本的if 命令cannot found?我编写了一个非常简单的脚本/bin/basha=1b=2if [

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
我习惯这么写 ,试试看