您的位置:首页 > 运维架构 > Shell

linux shell脚本syntax error near unexpected token `then'

2016-02-03 10:28 756 查看
       1 #!/bin/sh

      2 if["$SHELL"="/bin/bash"];then

      3    echo "your login shell is the bash(bourne agein shell)"

      4 else

      5    echo "your login shell is not bash but $SHELL"
      6 fi

今天编写了一个简单的shell脚本,执行时报错syntax error near unexpected token `then',

最后才发现:if和[之间一定要有一个空格,添加上之后执行正常。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: