7 ms·
You can just do trap 'caller 1' ERR should do the same thing. Also you should set "errtrace" (-E) and possibly "nounset" (-u) and "pipefail".
by Grimeton 1y ago
You can just do
trap 'caller 1' ERR
should do the same thing. Also you should set "errtrace" (-E) and possibly "nounset" (-u) and "pipefail".
- gkfasdfasdf 1y agoor even use caller to print a full backtrace: https://news.ycombinator.com/item?id=44636927 https://news.ycombinator.com/item?id=44636927
- progbits 1y agoThat's neat, but if your bash script needs a backtrace it should not be a bash script. To each their own though.
- williamdclt 1y agoMy bash scripts don't "need" a backtrace, but it sure is nicer than not having one