问题形容

xxxxx.sh line 13: if[ == N]: command not found

在编写shell 测试 script时遇到谬误

在应用if else elif 中遇到谬误

问题剖析

到stackoverflow上找到解答

问题属于语法标准注意事项的问题

if else 语句的应用标准

问题解决

查看这个答复和这个答复

例子

# 如果不部署if["$ifDeploy" == "N"]then    echo "thank you ,catch you later!"# 如果抉择部署elif["$ifDeploy" == "Y"]
  • if[ 之间须要space(空格)
  • [后和]前须要space(空格)

图示:

⚠️ 而且,如果编写格局不对,高亮显示也会不同!

相干文章:

  • Syntax error near unexpected token 'then'

猜你想看:

  • Shell Script - syntax error near unexpected token `else'