惜风不起、唯有努力!
shell 高级用法01

shell 高级用法01

#!/bin/bash
#user: yp

export NUM=44

function func(){
    local a=44
    printf "$a\n"
}
num=`func`
if [ "$num" == $NUM ];then
    echo "func is run!!"
else
    echo "func not run!!!"
fi
#!/bin/bash

export NUM01=50
export NUM02=60

if [ $NUM01 -lt $NUM02 -a $NUM02 -gt $NUM01 ];then     #逻辑与
    echo "all ok"
fi

if [ $NUM01 -gt $NUM02 -o $NUM02 -gt $NUM01 ];then     #逻辑或
    echo "ok"
fi

发表回复

您的电子邮箱地址不会被公开。