Can I use perl's switches with /bin/env in the shebang line?

前端 未结 4 1954
暖寄归人
暖寄归人 2020-12-17 10:26

I want to run perl -w using env. That works fine on the command line:

$ /bin/env perl -we \'print \"Hello, world!\\n\"\'
H         


        
4条回答
  •  遥遥无期
    2020-12-17 11:05

    It's worth noting that Mac OS X interprets characters after the shebang as arguments, so on OS X, the following will work:

    #!/usr/bin/env perl -wT
    enter code here
    

    However, since one of the points of using #!/usr/bin/env is to foster cross-platform compatibility, it's probably best not to use that syntax even if you're on a Mac mostly.

提交回复
热议问题