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.

4
  • pls consider to add a special note about why [[ ]] are not used Commented Feb 1, 2022 at 13:06
  • 1
    The builtin if doesn't require [[ ]], where you have to evaluate an expression. The syntax for if _commands_ ; then … is very simple, it just uses the return code of commands. Commented Feb 1, 2022 at 13:20
  • 1
    (I think the square brackets are only used so often because many shell scripts have been copy and pasted from older shell scripts for decades.) Commented Feb 1, 2022 at 13:21
  • 2
    @Erich Regarding your last comment, it's called "cargo cult programming". Commented Feb 1, 2022 at 13:56