[Purdue-pm] Problem with she-bang and PERL5OPT

Mark Senn mark at ecn.purdue.edu
Thu Nov 20 18:04:37 PST 2014


Rick Westerman <westerman at purdue.edu> wrote on 2014-11-20 at 14:52
>From all I have read the following program should work:
|  #!/bin/env PERL5OPT=-T perl
|  
|  warn 'Taint mode is '.(${^TAINT} ? 'on' : 'off');
|  
|  # End
|  
|  But when I run it, at least on the RCAC and on the Genomics systems, the
|  program just hangs.  Take away PERL5OPT and it works.  Put in '-w'
|  instead of '-T' and it fails in the same manner.  Quoting does not seem
|  to matter.  Just running from the command line:
|  
|  /bin/env PERL5OPT=-T perl program.file
|  
|  Works fine.
|  
|  I am mystified. Anyone have an idea?

From
http://stackoverflow.com/questions/2528959/how-do-i-set-the-taint-mode-in-a-perl-script-with-a-usr-bin-env-perl-sheba

    You cannot actually specify a variable in a shebang with
    /usr/bin/env. Doing so will cause env to execve itself in an infinite
    loop, never even getting to the command requested. I tested this against
    both Linux and FreeBSD. – Zed


Rick, I got the sme results with these scripts that you got with yours
    #!/bin/env /bin/cat
    hello there
and
    #!/bin/env TEMPVAR=hello /bin/cat
    hello there
(I wanted to try it with something simpler than perl.)

-mark


More information about the Purdue-pm mailing list