Y
Hacker News
new
|
ask
|
show
|
jobs
by
Grimeton
320 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".
1 comments
gkfasdfasdf
320 days ago
or even use caller to print a full backtrace:
https://news.ycombinator.com/item?id=44636927
link
progbits
320 days ago
That's neat, but if your bash script needs a backtrace it should not be a bash script. To each their own though.
link
williamdclt
320 days ago
My bash scripts don't "need" a backtrace, but it sure is nicer than not having one
link