Bash Scripting Quirks & Safety Tips

252

Yesterday I was talking to some friends about Bash and I realized that, even though I’ve been using Bash for more than 10 years now there are still a few basic quirks about it that are not totally obvious to me. So as usual I thought I’d write a blog post.

We’ll cover

  • some bash basics (“how do you write a for loop”)
  • quirky things (“always quote your bash variables”)
  • and bash scripting safety tips (“always use set -u”)

If you write shell scripts and you don’t read anything else in this post, you should know that there is a shell script linter called shellcheck. Use it to make your shell scripts better!

Read more at Julia Evans