SPUG: Bug in shebang parsing?

Fred Morris m3047 at inwa.net
Mon Jul 5 18:36:25 CDT 2004


m3047 at devil:~ > perl -v

This is perl, version 5.005_03 built for i586-linux

Copyright 1987-1999, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'.  If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.

m3047 at devil:~ > #! /usr/bin/perl -s -w
m3047 at devil:~ > $switch == 1;
bash: ==: command not found
m3047 at devil:~ > warn "Arguments are: @ARGV";
bash: warn: command not found
m3047 at devil:~ > # :-p
m3047 at devil:~ > cd perl
m3047 at devil:~/perl > mkdir tim-space
m3047 at devil:~/perl > cd tim-space
m3047 at devil:~/perl/tim-space > cat > one_space_sw
#! /usr/bin/perl -s -w
$switch == 1;
warn "Arguments are: @ARGV";
m3047 at devil:~/perl/tim-space > chmod a+x *
m3047 at devil:~/perl/tim-space > ./one_space_sw
Useless use of numeric eq in void context at ./one_space_sw line 2.
Name "main::switch" used only once: possible typo at ./one_space_sw line 2.
Use of uninitialized value at ./one_space_sw line 2.
Arguments are:  at ./one_space_sw line 3.
m3047 at devil:~/perl/tim-space > cat > one_space_ws
#! /usr/bin/perl -w -s
$switch == 1;
warn "Arguments are: @ARGV";
m3047 at devil:~/perl/tim-space > chmod a+x *
m3047 at devil:~/perl/tim-space > ./one_space_ws
Useless use of numeric eq in void context at ./one_space_ws line 2.
Name "main::switch" used only once: possible typo at ./one_space_ws line 2.
Use of uninitialized value at ./one_space_ws line 2.
Arguments are:  at ./one_space_ws line 3.
m3047 at devil:~/perl/tim-space > cat > two_spaces_sw
#! /usr/bin/perl -s  -w
$switch == 1;
warn "Arguments are: @ARGV";
m3047 at devil:~/perl/tim-space > chmod a+x *
m3047 at devil:~/perl/tim-space > ./two_spaces_sw
Arguments are:  at ./two_spaces_sw line 3.
m3047 at devil:~/perl/tim-space > cat > two_spaces_ws
#! /usr/bin/perl -w  -s
$switch == 1;
warn "Arguments are: @ARGV";
m3047 at devil:~/perl/tim-space > chmod a+x *
m3047 at devil:~/perl/tim-space > ./two_spaces_sw
Arguments are:  at ./two_spaces_sw line 3.
m3047 at devil:~/perl/tim-space >


HTH...

--

Fred Morris
fredm3047 at inwa.net (I-ACK)





More information about the spug-list mailing list