Hi all,
This is not a bash bug, but I am hoping the people on this list would
find the question interesting...
I have found it useful to have a "script-relative" version of
/usr/bin/env. Whereas env determines an interpreter's location based
on PATH, this version would determine the interpreter's location based
on the location of the script.
Example - the shebang line:
#!/usr/bin/relexec ../bin/perl
would execute the interpreter ../bin/perl relative to the location of
the script. The argv array of relexec will be:
argv[0] = "/usr/bin/relexec"
argv[1] = "../bin/perl"
argv[2] = "/some/path/to/script"
In this case relexec would exec /some/path/to/bin/perl with the
arguments in argv starting from argv[2].
If anyone is interested I can explain why/how I use this.
Questions:
- Does something like this already exist?
- I've noticed that the argument passed to the she-bang interpreter
always seems to be an absolute path when commands are executed from a
shell. Are there cases where that will not be true?