Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Feature request: Provide name of file being sourced, to the script.



On 04/13/2015 10:51 AM, Ronald Fischer wrote:
> While a zsh script can find out about itself (i.e. where it is located),
> by looking at the variable $0, a piece of code executed by the 'source'
> statement does not have this information. $0 always points to the script
> which "belongs" to the zsh process.
There is a few of ways to do that currently.

print ". $PWD/bar" > foo; print 'print $funcstack[1]' > bar; zsh foo
print ". $PWD/bar" > foo; print 'print ${(%):-%x}' > bar; zsh foo



Messages sorted by: Reverse Date, Date, Thread, Author