3 ms·
> How do you find where the script itself is? No program can do this portably.
by gnubison 5y ago
> How do you find where the script itself is?
No program can do this portably.
- chubot 5y agoI think you might be mixing two things up: it's impossible for a native program to find where it is, because argv[0] can be anything. But it's possible for an interpreter to tell the script it's interpreting where it lives, i.e. argv[1]. For example, Python does this in a pretty straightforward way.
- gnubison 5y agoYou're right, my bad.