字符串测试
# 1.==两个字符串相等
[root@egon ~]# [ "aaa" == "aaa" ];echo $?
0
# != 两个字符串不相等
[root@egon ~]# [ "aaa" != "aaa" ];echo $?
1
# -z 字符串长度为零
[root@db03 /scripts/day03]# ip=
[root@db03 /scripts/day03]# [ -z "$ip" ];echo $?
0
# -n 字符串长度不为零
[root@egon ~]# [ -n "$ip" ];echo $? # 注意加引号
1