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如果不为空

posted @ 2020-07-01 16:59  半日闲1  阅读(651)  评论(0编辑  收藏  举报