Open Artoria2e5 opened 8 years ago
Expected output:
[WARN] foo/bar.sh:233: blah.
Extra points for abdie: backtrace.
Crappy things:
.
recsr
Alternative solutions:
_abdie(){ ...:$errline: } alias abdie='errline=$LINENO _abdie'
This will result in some by-func-or-by-script addressing. When you get source from FUNCNAME[0], you should look at BASH_SOURCE instead.
source
FUNCNAME[0]
BASH_SOURCE
Expected output:
Extra points for abdie: backtrace.
Crappy things:
.
will introduce an extra level of func call.recsr
gives you two, but that is acceptable.Alternative solutions:
This will result in some by-func-or-by-script addressing. When you get
source
fromFUNCNAME[0]
, you should look atBASH_SOURCE
instead.