ok, I am slowly going insane. I can't seem to be able to get the absolute path and filename of the currently running script - that should be easy, right? $0 only gives me what the script was called as, and the current working directory can't always be trusted. What obvious thing am I missing?