News for hackers. Stuff that matters.
Re:Unix Shell Programming: The Next 50 Years [pdf] by coldtea on Friday June 04, 2021 @12:46PM (#27395555)
>Conceptually, the shell only sees the contents of the script, why would it act differently according to where the script is?

Doesn't need to act differently in what it does.

But it does need to report it, because e.g. you might want to bundle data/assets/config relative to the script, and want to be able to run it from wharever and have it still be able to find it.

Re:Unix Shell Programming: The Next 50 Years [pdf] by WildcardWiz on Friday June 04, 2021 @01:22PM (#27396106)
It's an interesting question. In most shell, it is possible to "source" a given file, which basically is a form of file inclusion. How should the script location feature behave in that situation? Should it report the sourced file location, or the sourcing one?

In the later case, does it mean that it is not possible to write reusable code based on that feature? In the former case, what should be done when sourcing is done recursively? Can this be used to defeat file location, for instance, by generating a script in /tmp and sourcing another file from it?