-2

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 2

0

-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 http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html

0
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .