Hacker News new | past | comments | ask | show | jobs | submit login

I 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.




You're right, my bad.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: