This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Problem with using "until" in "bash script"

I don't understand why it doesn't print 0 :

z=0 until (($z < 1)) do echo $z done

I don't understand why it prints 2 (2 is not less than 1) : output:

z=2 until (($z < 1)) do echo $z done

output:2

bash

You're confused with the while loop.

From that link:

The until loop is very similar to the while loop, except that the loop executes until the TEST-COMMAND executes successfully. As long as this command fails, the loop continues.

By the way this is not a bioinformatics question.

Yeah that's what I mean, it is kind of the opposite of while loop. OP seemed to expect while behavior.

Hello Afagh!

We believe that this post does not fit the main topic of this site.

Not a bioinformatics question

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

0 answers

No answers yet.

Log in to answer this question.