I\'m trying to find a way to find out what file and line number a function was called from. The function is in a library file which is being sourced by my script.
You are looking for caller it seems.
$ cat h.sh #! /bin/bash function warn_me() { echo "$@" caller } $ cat g.sh #!/bin/bash source h.sh warn_me "Error: You didn't do something" $ . g.sh Error: You didn't do something 3 g.sh