Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I have a piece of code like this:

count=0
until [ -f $filename -o $count -ge 60 ]
do
  count=$((count+1))
  sleep 1
done

I know [ -f $filename -o $count -ge 60 ] is a test command, "-f $filename" tests if the file exists or not, "$count -ge 60" tests if count is greater than or equal to 60, what does "-o" mean?

I googled, can't find the answer, anyone can help?

share|improve this question
    
Try the help command for builtins: help test (help [ will tell you it's actually test). –  muru Sep 22 '14 at 18:53

2 Answers 2

up vote 1 down vote accepted

It's logical OR operator.

From bash documentation:

expr1 -o expr2
    True if either expr1 or expr2 is true.
share|improve this answer

It is a logical or operation. The code checks if $filename exists once/second for 60 seconds.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.