On Thu, May 24, 2001 at 11:38:32AM +0100, Hobson, Neville wrote:
> I'm writing perl scripts that will be distributed to locations where I
> cannot gaurantee the location of perl. Is there a clean alternative to the
> shebang with the specific perl path? Maybe using an environment variable to
> locate perl?
> The camel book suggests the following:
>
> #!/bin/sh --
> eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
> if 0;
You can also try:
#!/usr/bin/env perl -w
[ rest of script ]
And that will invoke the first perl found in $PATH, and it will invoke
it with the -w switch turned on.
(I *think* env is always installed in /usr/bin, but I'm not absolutely
positive at the moment.)
Z.