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*

3
  • 8
    The second one would create the directory, if it didn't exist at first. Then it's not idempotent. Commented Mar 6, 2019 at 6:47
  • 2
    👆👆👆. The 2nd one seems dangerous. Since it creates the directory, it's not even true anymore that the dir is not present. Commented Feb 7, 2020 at 21:38
  • mkdir will also not create the full path (without a param), but the opposite would be even more dangerous, as you are not even able to revert (rm -f) the changes as you don't know which directories it created Commented Mar 23, 2021 at 23:19