in reply to Modifying %ENV From The Shebang Line

First, what's with env all over the place? Not only is it useless, I think it's actually hurting here. You're asking it to locate the program LD_LIBRARY_PATH=/my/lib.

Secondly, perlrun doesn't mention
#!/bin/sh -- -*- perl -*-
but it does mention
#!/bin/sh -- # -*- perl -*-
Unfortunately, that doesn't work with my sh.

However, it's easy to work around that using -x.

#!/bin/sh eval 'MYTESTVAR=/my/lib exec /usr/bin/perl -x -S $0 ${1+"$@"}' if $runningUnderSomeShell; #!perl print "[", $ENV{MYTESTVAR}, "]\n";

Replies are listed 'Best First'.
Re^2: Modifying %ENV From The Shebang Line
by williams (Beadle) on Dec 17, 2007 at 23:55 UTC
    Well, that's good enough for the front burner, i.e., that works great! I'll press on with -x.

    You're right about perlrun, though it doesn't matter. My code was right; my post was wrong, and I'll correct it.

    Thanks to all who replied. I've now been made whole by PerlMonks yet again.

    Jim