Re: locating a sourced file



How can a sourced file determine its location?

Source files cannot determine anything - they are not executables.

I think the OP mean how can a sourced file (like in shell ./file.sh)
determine it's location. This sounds like home work so I won't answer
this directly but take a look at the variable $0.

If it is homework, it strikes me as being a rather advanced class :^)

No, it is NOT a homework!

Looking at $0 certainly won't help.

Yes, it does not help.

I doubt that there is a way, but maybe somebody here is smarter than I am.

If there exists such a guy, could they please, enlighten us.
.