I’m on a proprietary server; I know nothing about it. There’s a bash function we use routinely to describe the server but if I write a bash script that uses that function it won’t work.
So I want to load the original source file in the script. Is there a way to determine the location of the source file besides a “brute-force” search approach? If I do type -a thefunction I can see the definition but not where it was sourced from.
This information isn’t readily available. What may help is to start an interactive login shell with debugging (set -x) enabled. This will show you the source process in detail.
When I initiate a bash shell like this, I see something like the following:
This shows me that when . /etc/bash_completion/dd was sourced, PATH was modified (or possibly re-set to the same values).