Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm firmly in that camp but I also always add `set -eux`, which makes it so much better at debugging as that gives you individual commands it runs before the output of them.


To be clear, the difference is something along this line:

    $ bash -ec 'echo hello && ls -la /tmp/ | grep systemd && false && echo testing'
    hello
    drwx------.   3 root   root      60 Mar 29 18:33 systemd-private-bluetooth.service-yuSMVM
    drwx------.   3 root   root      60 Mar 29 18:33 systemd-private-upower.service-YhHHP2
versus

    $ bash -euxc 'echo hello; ls -la /tmp/ | grep systemd; false; echo testing'
    + echo hello
    hello
    + ls -la /tmp/
    + grep systemd
    drwx------.   3 root   root      60 Mar 29 18:33 systemd-private-bluetooth.service-yuSMVM
    drwx------.   3 root   root      60 Mar 29 18:33 systemd-private-upower.service-YhHHP2
    + false
Docker also supports the `SHELL` syntax now, which is even better, because you can set it once at the top of the Dockerfile without having to do the whole `set -eux` on every line.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: