Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

libbase/ab{die,warn,err,info,...}: Use BASH_SOURCE & BASH_LINENO in err msgs #92

Open
Artoria2e5 opened this issue May 7, 2016 · 0 comments

Comments

@Artoria2e5
Copy link
Contributor

Artoria2e5 commented May 7, 2016

Expected output:

[WARN] foo/bar.sh:233: blah.

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:

_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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant