简体   繁体   中英

What does -z and -o commands mean in Linux shell script?

I have a script.sh shell script where in I come across the following line in a function :

if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; 

then
        ....

else
        ....

fi

I want to know what the -z and -o in the If statements means

Thanks

Its quite basic actually: -z means test for empty string (zero length) -o is a OR operation

If you want to do scripting in bash I recommend you go through "Bash Beginners Guide". It will cover the necessary basics, and does not take much time.

http://tldp.org/LDP/Bash-Beginners-Guide/html/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM