Shebang line (perl script) running on both UNIX and Windows

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dxz
    New Member
    • Mar 2008
    • 1

    #1

    Shebang line (perl script) running on both UNIX and Windows

    I have a perl script to run on both UNIX and Windows. How should I write the Shabang line:

    On UNIX, it is
    #!/usr/bin/perl
    On Windows, it is
    #!C:\perl\bin\p erl.exe

    Which one should I use?
    Should I combine them?
    If yes, how?

    Thanks,
    dxz
  • KevinADC
    Recognized Expert Specialist
    • Jan 2007
    • 4092

    #2
    windows ignores the shebang line, but if you plan on writing CGI scripts the http server may need to read the shebang line. If you are not writing CGI scripts just use the Unix shebang line and windows will ignore it. If you are writing CGI scripts then you will need to change the shebang line or inform the end-user it will need to be changed.

    Comment

    Working...