Paolo Bonzini <bonz...@gnu.org> writes:

> Yeah.  But why not the standard
>
> #! /bin/sh
> eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
>     if 0;
>
> suggested in perlrun(1)?

Actually that doesn’t work:

--8<---------------cut here---------------start------------->8---
$ ./build-aux/gitlog-to-changelog  
/bin/sh: -S: invalid option
--8<---------------cut here---------------end--------------->8---

because perl eventually execs /bin/sh:

--8<---------------cut here---------------start------------->8---
4473  execve("./build-aux/gitlog-to-changelog", 
["./build-aux/gitlog-to-changelog"], [/* 60 vars */]) = 0
4473  execve("/var/run/current-system/sw/bin/perl", ["perl", "-S", 
"./build-aux/gitlog-to-changelog"], [/* 59 vars */]) = 0
4473  execve("/bin/sh", ["/bin/sh", "-S", "./build-aux/gitlog-to-changelog"], 
[/* 59 vars */]) = 0
--8<---------------cut here---------------end--------------->8---

Actually perlrun(1) reads this:

--8<---------------cut here---------------start------------->8---
           #!/bin/sh -- # -*- perl -*- -p
           eval 'exec perl -wS $0 ${1+"$@"}'
               if $running_under_some_shell;
--8<---------------cut here---------------end--------------->8---

... which can’t possibly work.

So I guess I’ll stick to what I suggested.

Thanks,
Ludo’.



Reply via email to