[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Execing perl?
From: |
Chet Ramey |
Subject: |
Re: Execing perl? |
Date: |
Wed, 11 Jul 2001 15:02:35 -0400 |
> OK, this isn't a bug, and it's also something that you'd _think_ would
> be so obvious it'd be right at the top of all the FAQs, etc... but I
> can't find it, nor can I figure it out.
>
> The Perl docs (perlrun) say you can use this stanza to write a perl
> script when you don't know where the perl runtime will be; something
> like:
>
> #!/bin/sh -- # -*- perl -*-
> eval 'exec perl -wS $0 ${1+"$@"}'
> if $running_under_some_shell;
>
> This doesn't work if bash is /bin/sh; I get this error:
>
> /bin/sh: -- # -*-perl-*-: unrecognized option
This really doesn't have anything to do with the shell, per se. The
kernel is passing the rest of the line to /bin/sh as argv[1], and
bash is attempting to open it as a shell script.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet)
Chet Ramey, CWRU chet@po.CWRU.Edu http://cnswww.cns.cwru.edu/~chet/
- Re: Execing perl?,
Chet Ramey <=