From: Paul D. Smith (pausmith@nortelnetworks.com) Subject: Re: Execing perl? Newsgroups: gnu.bash.bug Date: 2001-07-11 12:18:04 PST %% prj@po.cwru.edu (Paul Jarc) writes: pj> This will break *any* interpreter, as long as it's on Linux. Linux pj> passes everything after the first space as a single argument to the pj> interpreter. Doh! pj> The eval stuff isn't what you want anyway, and I don't pj> think it ought to be used that way in the perlrun man page. It's pj> meant to be used like this: pj> #!/path/to/perl pj> eval 'exec perl -wS $0 ${1+"$@"}' pj> if $running_under_some_shell; This can't work for me. My entire goal is to invoke Perl when I don't know the path. I have lots of different systems, with different OS's on them, and Perl is installed on different places on each of them. I want to run the same script on all of them. If you use an invalid path in the #! commandline, then it just fails. pj> The next example in the perlrun man page is what you want: pj> #!/usr/bin/env perl pj> This assumes a location for env, but searches for perl in $PATH. I saw that; I don't want to assume a location for env, either. How frustrating! Other interpreters all have straightforward ways of doing this. Perl is getting too fancy for its own britches, with this special attempt to emulate sh-bang processing if the word "perl" doesn't appear on the first line :-/. At the least there should be a way to disable that. -- ------------------------------------------------------------------------------- Paul D. Smith HASMAT--HA Software Methods & Tools "Please remain calm...I may be mad, but I am a professional." --Mad Scientist ------------------------------------------------------------------------------- These are my opinions---Nortel Networks takes no responsibility for them.