options that can be used in if condition check

if [ -z "$1" -o -z "$2" ] - Here i know that -z option is used to check for zero length string but why we are using -o option along with -z.

And also tell me any suitable link to study about those options

Thanks in advance,

2 Answers

-o simply stands for OR. The expression is true if one of the strings had a zero length. Have a look at table 7.2 on

0

The "[" is an alias to the test bash builtin.

$ test 1 -gt 2
$ echo $?
1

is equivalent to

$ [ 1 -gt 2 ]
$ echo $?
1

You can see the relative man page for further options.

man test

or this article for example

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like