#!/bin/bash
type="release"
build="prd"
if [ $type == "release" ] ;then
echo "release"
if [ $build == "prd" ];then
echo "prd"
elif [ $build == "stg" ];then
echo "stg"
fi
elif [ $type == "debug" ];then
echo "debug"
if [ $build == "prd" ];then
echo "prd"
elif [ $build == "stg" ];then
echo "stg"
fi
fi
报错类型:
test.sh: line 4: syntax error near unexpected token `then'
test.sh: line 4: `if[ $type == "release" ] ;then'
错误写法:
if[$STR1=$STR2]
正确写法:
if [ $STR1 = $STR2 ]
[]两边都要加空格