in reply to Re: How to use dynamic execution path instead of absolut.
in thread How to use dynamic execution path instead of absolut.

`which perl` -x $0 $*
That's a useless use of backticks. which will only find something which is in the PATH, and then shell can find it as well, so you can just rephrase that as perl -x $0 $* That reminds me - perlrun has the following snippet:
#!/bin/sh eval 'exec perl -S $0 ${1+"$@"}' if $running_under_some_shell; # regular perl code follows here
If you really want, you can also put switches for Perl at the end of the shebang line if it looks like so: #!/bin/sh -- # -*- perl -*- -wT

Makeshifts last the longest.

Replies are listed 'Best First'.
Re: Re^2: How to use dynamic execution path instead of absolut.
by busunsl (Vicar) on Jan 14, 2003 at 11:59 UTC
    That's a useless use of backticks. which will only find something which is in the PATH, and then shell can find it as well, so you can just rephrase that as

    perl -x $0 $*

    Arrgh! You're absolutly right!