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.

9
  • 5
    I think this is better than the accepted answer.
    – qed
    Commented Apr 5, 2013 at 10:00
  • 5
    Why are you recommending a non-portable feature when doing so gives no benefit? Commented Nov 24, 2014 at 8:16
  • 27
    @AlastairIrvine: I mention portability in the first sentence of my answer, the question title and body contain the word "Bash" and the question is tagged bash, and the double bracket structure provides clear advantages in many ways. And I don't recommend mixing bracket styles for reasons of consistency and maintainability. If you need maximum, lowest common denominator portability, use sh instead of Bash. If you need the increased capabilities that it provides, use Bash and use it fully. Commented Nov 24, 2014 at 13:59
  • 3
    @BrunoBronosky: I reverted the edit. There's no requirement for ; at the end. The then can be on the next line without a semicolon at all. Commented Nov 30, 2016 at 23:52
  • 7
    You can do that, but a puppy dies every time you put then on its own line. Commented Dec 1, 2016 at 3:11