Linux-kernel mailing list archive 2000-07,: Re: #! and argv[0]: the path is removed before invoking the interpreter

# Re: #! and argv[0]: the path is removed before invoking the interpreter

Q (Q@ping.be)
Wed, 16 Feb 2000 23:19:00 +0100

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Alan Cox: "Re: #! and argv[0]: the path is removed before invoking the interpreter"
- Previous message: Alexander Viro: "Re: Of removable devices"
- In reply to: Kevin Layer: "#! and argv[0]: the path is removed before invoking the interpreter"
- Next in thread: Alan Cox: "Re: #! and argv[0]: the path is removed before invoking the interpreter"

On Wed, Feb 16, 2000 at 10:49:35AM -0800, Kevin Layer wrote:
>
> I have an interpreter of #! scripts that absolutely needs to know the
> full path of where the executable is, and I can't assume it will be in
> the user's path. Getting it in argv[0] is the cleanest way. That is,
> I can tell users they have to use the full path in the #!, if they
> want to use my interpreter.
>
> I believe the behavior of #! on Solaris goes all the way back to BSD
> in of the early 80's. FreeBSD 3.0 behaves as Solaris does.

I've hit the same problem once. I've "fixed" it by using the path compiled
in. An other option was an env variable. Don't like either of those two.

btw: Someone will probably tell that argv[0] is not always the executable
but could be a sym-link, which I my case was good enough, because it was
supposed to be in the same dir as the executable.

I think this behavior is new since 2.2, but not sure tho.

Q

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

- Next message: Alan Cox: "Re: #! and argv[0]: the path is removed before invoking the interpreter"
- Previous message: Alexander Viro: "Re: Of removable devices"
- In reply to: Kevin Layer: "#! and argv[0]: the path is removed before invoking the interpreter"
- Next in thread: Alan Cox: "Re: #! and argv[0]: the path is removed before invoking the interpreter"