Remix.run Logo
Grimeton 3 days 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 3 days ago | parent [-]

or even use caller to print a full backtrace: https://news.ycombinator.com/item?id=44636927

progbits 3 days ago | parent [-]

That's neat, but if your bash script needs a backtrace it should not be a bash script. To each their own though.

williamdclt 3 days ago | parent [-]

My bash scripts don't "need" a backtrace, but it sure is nicer than not having one