Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

/usr/bin/perl -w?

by biochris (Beadle)
on Jun 20, 2005 at 19:53 UTC ( #468472=perlquestion: print w/replies, xml ) Need Help??

biochris has asked for the wisdom of the Perl Monks concerning the following question:

I try to run a logon perl script on RedHat Workstation 3. When I run a ps -ef I see my script as /usr/bin/perl -w? script_name Anyone knows why I get the question mark after the -w switch? Thank you

Replies are listed 'Best First'.
Re: /usr/bin/perl -w?
by ysth (Canon) on Jun 20, 2005 at 20:33 UTC
    Just at a guess, your script has a CR at the end of the shebang line?
      Thank you so much :)
Re: /usr/bin/perl -w?
by chas (Priest) on Jun 20, 2005 at 21:14 UTC
    And with regard to ysth's reply, I once noted that if my shebang line was #!/usr/bin/perl followed by a carriage return (due to editing the script on a Windows machine and then transferring to Linux), the script exited with an error that the command was not found. (Putting -w at the end of the line fixed the problem, because then the carriage return was ignored as an unknown option, I think.) You can check if the return is there by editing the script in binary mode with vi(m) or emacs, etc.
        Some people take the approach of creating a "/usr/bin/perl\r" link to /usr/bin/perl :)

        And Unix commands in general, too! Because of shell design and such, typing rm * in a directory which contains a file named -rf could delete everything (except the file -rf)! You should do rm -- * instead. I have actually been bitten by this once or twice, but luckily not by -rf but something more mundane.

      Looks like it worked. thanks so much
Re: /usr/bin/perl -w?
by aditya.singh (Acolyte) on Jun 22, 2005 at 09:36 UTC
    Check you shebang(#!) line. You probably have ^M or some other unprintable character there.
      Yep, that was the problem. Thanks

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://468472]
Approved by ikegami
Front-paged by ikegami
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2023-02-07 11:50 GMT
Find Nodes?
    Voting Booth?
    I prefer not to run the latest version of Perl because:

    Results (39 votes). Check out past polls.