Questions tagged [shebang]

The #! marker at the beginning of scripts is called a shebang.

The #! marker at the beginning of scripts is called a shebang.

See

486 questions
13
votes
8 answers

How do I ignore the Perl shebang on Windows with Apache 2?

I have set up a local Perl web environment on my Windows machine. The application I'm working on is originally from a Linux server, and so the shebang for source .pl files look like so: #!/usr/bin/perl This causes the following error on my Windows…
Nick Bolton
  • 38,276
  • 70
  • 174
  • 242
13
votes
3 answers

Recognize a file with a shebang and no extension

I know that emacs can recognize a file by the extension, a -*- mode -*- first line, and even by the shebang line, but what do I do if I want to override the shebang? For example, a script that starts with #!/usr/bin/env python2.7 ... won't be…
Shep
  • 7,990
  • 8
  • 49
  • 71
13
votes
3 answers

Which shebang should I use for F# scripts in Mac OS X?

I have F# 2.0 installed with Mono, and I'd like to ./ my F# scripts. Which shebang line should I use for Mac OS X? Can this shebang line be generalized for Mac OS X and Linux?
mcandre
  • 22,868
  • 20
  • 88
  • 147
12
votes
1 answer

How does argparse (and the deprecated optparse) respond to 'tab' keypress after python program name, in bash?

I have tested optcomplete working with the optparse module. Its example is a simple file so I could get that working. I also tested it using the argparse module as the prior one is deprecated. But I really do not understand how and by whom the…
0xc0de
  • 8,028
  • 5
  • 49
  • 75
12
votes
3 answers

Git: how to deal with different shebang

How do people deal with different shebangs between local and remote? For example, my local python is /usr/bin/python, whereas my web host is a purpose-built python at ~/local/bin/python. A lead developer may have ruby at /usr/bin/ruby, whereas…
Nick Coleman
  • 465
  • 3
  • 10
12
votes
2 answers

shebang line not working in R script

I have the following script #!/usr/bin/Rscript print ("shebang works") in a file called shebang.r. When I run it from command line using Rscript it works $ Rscript shebang.r but when I run it from the command line alone $ shebang.r It doesn't…
Milktrader
  • 9,278
  • 12
  • 51
  • 69
12
votes
2 answers

Why is "use" not allowed, as in "use strict;" in Perl 5.14?

I am trying to use the following conventions I have been instructed to use for good/proper/safe Perl code for my "Hello, World!" Program: use strict; use warnings; I have created and successfully run the following "Hello World" program using…
bc1984adam
  • 173
  • 1
  • 9
12
votes
4 answers

What is the significance of -T or -w in #!/usr/bin/perl?

I googled about #!/usr/bin/perl, but I could not find any satisfactory answer. I know it’s a pretty basic thing, but still, could explain me what is the significance of #!/usr/bin/perl in Perl? Moreover, what does -w or -T signify in…
vijay
  • 2,034
  • 3
  • 19
  • 38
11
votes
5 answers

What does the symbol "#!" mean in Python?

What does this line of code mean? Without it, my python3 http server can't understand and let the browser download an empty .py file (depend on the link to the .py file) #! /usr/local/bin/python3
Amumu
  • 17,924
  • 31
  • 84
  • 131
11
votes
8 answers

How to fix shebang flags that are not recognized on some systems

For some reason, the -O (optimized) flag is not recognized in the shebang line on a Red Hat Enterprise Server (release 5.3) that I access. On other systems, the flag is recognized without any issue. Executing the script below on OS X works fine.…
awesomo
  • 8,526
  • 2
  • 21
  • 24
11
votes
4 answers

how to make a python or perl script portable to both linux and windows?

I was wondering how to make a python script portable to both linux and windows? One problem I see is shebang. How to write the shebang so that the script can be run on both windows and linux? Are there other problems besides shebang that I should…
Tim
  • 1
  • 141
  • 372
  • 590
11
votes
2 answers

How do I set the taint mode in a perl script with a '#!/usr/bin/env perl'- shebang?

how do I set the taint mode in a perl script with a #!/usr/bin/env perl shebang?
sid_com
  • 24,137
  • 26
  • 96
  • 187
11
votes
3 answers

run python script directly from command line

#!/usr/bin/env python I put that at the top of a script. I've seen that should make the script runnable from the command line without the need for python programname.py. Unless I'm misunderstanding I should be able to use programname.py as long…
confused
  • 1,283
  • 6
  • 21
  • 37
10
votes
4 answers

When scripting, what's the difference between #!/usr/bin/perl and #!/usr/bin/env perl?

Obviously this applies equally with python, bash, sh, etc substituted for perl! Quentin's answer below was clearly correct, and so I've accepted it, but I guess what I actually meant was 'what are the pros and cons of the two ways of using #! to…
John Lawrence Aspden
  • 17,124
  • 11
  • 67
  • 110
10
votes
2 answers

Is it possible to create a self-rendering Rmarkdown document?

For typical R scripts the shebang syntax can be used to run the code within. With a file file.R #!/usr/bin/env Rscript Running ./file.R will execute the code. But can somehow the same be done with R-markdown? So that with a file…
Karolis Koncevičius
  • 9,417
  • 9
  • 56
  • 89