Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library

Comment by sandreas

4 years ago

Shell scripting: https://pilabor.com/blog/2021/04/shell-scripting-cheatsheet/

Markdown: https://pilabor.com/blog/2021/04/markdown-cheatsheet/

2 comments

sandreas

Reply

johnchristopher  4 years ago

> mkdir if not exists

  [ -d "${DIR}" ] || (mkdir -p "${DIR}")

No need to check when using "-p".

  • sandreas  4 years ago

    You are absolutely right :-) I think, that this is a relict, since I personally use an alias for mkdir:

      alias mkdir='mkdir -p'
    

    Thank you

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities