Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • If you put some debug (an echo statement) in the inner loop does it get executed? With the right values? What values are actually being tested by the innermost if - are they what you'd expect? Commented Feb 27, 2020 at 22:15
  • 1
    In general terms, don't use all-caps variable names - you could easily end up clashing with reserved names. Also, use #!/bin/bash as the first line. Finally, don't mix [ ... ] and [[ ... ]] - use one or the other - and learn about [[ -z "$var" ]] instead of the ancient [ "x$var" = "x" ] thing. Commented Feb 27, 2020 at 22:17
  • 1
    It's like two different people have written this code, but used different styles (and years). Good maintenance style is to be consistent: copy what's already there or update it all to the modern style. Commented Feb 27, 2020 at 22:19
  • Good eye roaima. 2 diff people did write this. I figured I could just import a block of code and that would be it. Commented Feb 28, 2020 at 12:08