On Sun, 2004-08-08 at 04:06, JupiterHost.Net wrote:
> I found this code in a script right after the she-bang line:
> 
> eval 'exec /usr/bin/perl -T -w -S $0 ${1+"$@"}'
>      if 0; # not running under some shell
> 
> What is it doing?

Hi.

From `perldoc perlrun`, under -S :

Typically this is used to emulate #! startup on platforms that
don't support #!.  This example works on many platforms that have
a shell compatible with Bourne shell:

        #!/usr/bin/perl
        eval 'exec /usr/bin/perl -wS $0 ${1+"$@"}'
                if $running_under_some_shell;

[ ... etc ... ]

It goes on, so you have a more detailed explanation there...

The line you have is similar enough to that one.

> Its like its executing itself again, but why?
> 
> What the heck is: ${1+"$@"} ??
> 
> Wouldn't the eval never get done because of the if 0; ??

Right. Probably your system supports #!, right? :-)

> So why eval a piece of code that willnever be eval'ed ?

I guess the line is still there for some reason... I can think of
several possibilities :-|

> 
> Thanks!
> 
> Lee.M - JupiterHost.Net
-- 
José Alves de Castro <[EMAIL PROTECTED]>
  http://natura.di.uminho.pt/~jac

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to