shell中的运算符及判断参数为空

大于 -gt (greater than) 
小于 -lt (less than) 
大于或等于 -ge (greater than or equal) 
小于或等于 -le (less than or equal) 
不相等 -ne (not equal)

if [ -z $n1 ]     :-z 空的意思   即,n1如果为空

if [ -n $n1 ]     :-n 非空的意思,即,n1如果不为空

原文地址:https://www.cnblogs.com/yu121/p/13220172.html