shell - Bash scripting, multiple conditions in while loop -


I am trying to get a general position while using two situations, but different syntax forums, I Error can not stop throwing what I have here:

  while [$ stats -gt 300] -o [$ stats -eq 0]   

I Also tried:

  while [[$ stats -gt 300] || || [$ Figures -Ece 0]]   

... as well as many other constructions I have to continue this loop, while $ stats & gt; 300 or $ stats = 0 .

The right choice (increasing in order of recommendation):

  Single POSISIS test commander with #Oo operator (now not recommended) # It is strongly recommended to keep quotation free from blank or undefined variables, while ["$ statistics" -gt 300 -o "$ figures" -ece 0] # Two POSIsi joined the list with test orders || # It is strongly recommended to keep quotation from blank or undefined variable while ["$ figures" -gt 300] || ["$ Statistics" -ece 0] # Two hardcore conditional manifestations joined a list || While [[$ figures - gt 300]] || [[$ Figures - EC 0]] # Single bash conditional expression || Operator While [[$ figures - gt 300 || $ Stats -Ece 0]] #bash arithmetic expressions joined in a list || # $ Optional can be interpreted as a single variable only in the form of a string ((Statistics> 300)) ((Statistics == 0)) and finally, a single bash arithmetic expression || Operator # $ Optional can be interpreted as a single variable in the form of a string ((Statistics> 300 || statistics == 0))   

Some notes: / P>

    [...]] and (in ...) is; If the variable is not set, then the value of -gt and -eq 0 will be assumed.

  1. Using $ is optional ((...)), but using it unknowingly errors Can help you avoid it. If statistics is not set, then ((Statistics> 300)) will go to statistics == 0 , but (( $ Stats> 300)) will generate a syntax error.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -