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

In Bash 4.4+ you can use:

  shopt -s inherit_errexit 2>/dev/null || true
To make subprocesses inherit the errexit flag.


               inherit_errexit
                       If  set,  command  substitution  inherits  the value of the errexit option,
                       instead of unsetting it  in  the  subshell  environment.   This  option  is
                       enabled when posix mode is enabled.

So must I presume older versions were already doing that without needing an option set?


Lifesaver! Without this, error handling in bash functions is a gigantic, unintuitive pain. Thank you for bringing this to my attention.


And this boilerplate isn't going to be a pain?




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

Search: