Bash #1

I’m currently working on automating our deployment with Bash scripts. For a TDD loving Java programmer it can be quite hard to figure this all out, but I’m getting better. I don’t ever think I’ll start to love it, but maybe one day I can like it. 😉 I’ll try to share small snippets of what I learn here.


set -e
set -u

I always have these early in my scripts. That way I know if anything fails (set -e) and if any variables is undefined (set -u).

Any other tips?

3 thoughts on “Bash #1

  1. Erik

    Bash -x flag to enable debugging is helpful. Or the alternative:

    set -x # activate debugging from here

    set +x # stop debugging from here

    Reply
  2. Yu-Jie Lin

    My advise: don’t use Bash for that unless those tasks only involve a few common Unix-like commands.

    I don’t know how complicated your development process is, but if it’s complicated, then using Bash is inefficient and probably would only trouble you more.

    Since you are a Java programmer, why not just write in Java? You are familiar with it. Or Python, Ruby, even JavaScript.

    Reply

Leave a Reply to Anders Cancel reply

Your email address will not be published. Required fields are marked *