简单的if else shell脚本

时间:2015-12-02 13:10:19

标签: shell if-statement sh

我尝试使用sample.sh命令执行文件sh sample.sh,该命令包含以下代码:

#!/bin/sh

a=10
b=20

if [ $a == $b ]
then
   echo "a is equal to b"
else
   echo "a is not equal to b"
fi

所以当我尝试执行时,我得到以下错误:

: command not foundine 2:
: command not foundine 5:
sample.sh: line 11: syntax error near unexpected token `fi'
sample.sh: line 11: `fi'

有人可以帮助我吗,我哪里出错了?

0 个答案:

没有答案
相关问题