判断变量是否为空
#!/bin/sh
a=
# 判断中的双引号要加
if [ ! -n "$a" ]; then
echo "IS NULL"
else
echo "NOT NULL"
fi
判断状态
if [ $status= "active" ];then
fun1
elif [ $status= "standby" ];then
fun2
else
echo "状态异常"
fi
判断变量是否为空
#!/bin/sh
a=
# 判断中的双引号要加
if [ ! -n "$a" ]; then
echo "IS NULL"
else
echo "NOT NULL"
fi
判断状态
if [ $status= "active" ];then
fun1
elif [ $status= "standby" ];then
fun2
else
echo "状态异常"
fi