Quote:
Originally Posted by Al262
Not really much help. The link tried to provide workarounds rather than answering the question. There are times when inside the script, it doesn't know what directory it is in. Seems like a $0 equivalent should be available for a sourced file.
|
You'd think , huh?
But it ($0 in the sourced shell) is not what what it's in the 'called' (not sourced) script - as the 'sourced' script runs in the same process space (there's no newly forked process) as the 'sourcing' script. Therefore, the '$0' in the sourced script is the '$0' of the sourcing script.
I'm not sure if I'm explaining this correctly - you can take a look at this
thread or browse this
comp.unix.shell user group for similar threads.