shebang

Makefile as an executable script with shebang?

一世执手 提交于 2019-11-27 02:08:35
问题 Is it possible to create an executable script that would be interpreted by make? I tried this: #!/usr/bin/env make --makefile=/dev/stdin main: @echo Hello! but it does not work - hangs until press Ctrl-c . 回答1: #!/usr/bin/make -f main: @echo Hello World! Is normally all you need in a standard make file. The filename is implicitly passed as the last argument. /dev/stdin here is (usually) the tty. You can do the whole env thing if there's a reason to, but often there's no need. ajw@rapunzel:~

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

二次信任 提交于 2019-11-27 01:52:49
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 dev machine: (OS 2)The system cannot find the file specified. Is it possible to change my Apache 2 conf so that the shebang is ignored on my Windows machine? Of course I could set the shebang to #!c:\perl\bin\perl.exe , that much is obvious; but the problem comes to deploying the updated files. Clearly it would be very inconvenient to change this

Why should the shebang line always be the first line?

▼魔方 西西 提交于 2019-11-27 01:49:26
问题 I have a simple perl script as below: #!/usr/bin/perl use strict; use warnings; print "hello world!\n"; I can execute this script as below: >temp.pl hello world! > If I add some comments like this: #this script is just for test #the shebang #!/usr/bin/perl use strict; use warnings; print "hello world!\n"; and when I try to execute, it gives me output as below: > temp.pl use: Command not found. use: Command not found. print: Command not found. > The point here is the shebang line should be

Use shebang/hashbang in Windows Command Prompt

China☆狼群 提交于 2019-11-27 01:15:37
问题 I'm currently using the serve script to serve up directories with Node.js on Windows 7. It works well in the MSYS shell or using sh , as I've put node.exe and the serve script in my ~/bin (which is on my PATH), and typing just "serve" works because of it's Shebang ( #! ) directive which tells the shell to run it with node. However, Windows Command Prompt doesn't seem to support normal files without a *.bat or *.exe extension, nor the shebang directive. Are there any registry keys or other

What does the line “#!/bin/sh” mean in a UNIX shell script?

泪湿孤枕 提交于 2019-11-26 23:41:58
I was going through some shell script tutorials and found the following sample program: #!/bin/sh clear echo "HELLO WORLD" Can anyone please tell what is the significance of mentioning ' !/bin/sh ' in the comment? Marc B It's called a shebang , and tells the parent shell which interpreter should be used to execute the script. e.g. #!/usr/bin/perl <--perl script' #!/usr/bin/php <-- php script #!/bin/false <--- do-nothing script, because false returns immediately anyways. It's implemented as a comment so that anything coming in that line will not "relevant" to the interpreter specified. e.g. all

Why is #!/usr/bin/env bash superior to #!/bin/bash?

北慕城南 提交于 2019-11-26 23:22:04
I've seen in a number of places, including recommendations on this site ( What is the preferred Bash shebang? ), to use #!/usr/bin/env bash in preference to #!/bin/bash . I've even seen one enterprising individual suggest using #!/bin/bash was wrong and bash functionality would be lost by doing so. All that said, I use bash in a tightly controlled test environment where every drive in circulation is essentially a clone of a single master drive. I understand the portability argument, though it is not necessarily applicable in my case. Is there any other reason to prefer #!/usr/bin/env bash over

Should I use a Shebang with Bash scripts?

谁说胖子不能爱 提交于 2019-11-26 23:12:03
问题 I am using Bash $ echo $SHELL /bin/bash and starting about a year ago I stopped using Shebangs with my Bash scripts. Can I benefit from using #!/bin/sh or #!/bin/bash ? Update: In certain situations a file is only treated as a script with the Shebang, example $ cat foo.sh ls $ cat bar.sh #!/bin/sh ls $ file foo.sh bar.sh foo.sh: ASCII text bar.sh: POSIX shell script, ASCII text executable 回答1: On UNIX-like systems, you should always start scripts with a shebang line. The system call execve

What is the difference between “#!/usr/bin/env bash” and “#!/usr/bin/bash”?

余生颓废 提交于 2019-11-26 21:13:48
In the header of a bash script, what's the difference between those two statements ? #!/usr/bin/env bash #!/usr/bin/bash When I tried to see the env man page, I get this definition: env - run a program in a modified environment What does it mean? Alec Bennett Running a command through /usr/bin/env has the benefit of looking for whatever the default version of the program is in your current env ironment. This way, you don't have to look for it in a specific place on the system, as those paths may be in different locations on different systems. As long as it's in your path, it will find it. One

What should I use for a Perl script's shebang line?

∥☆過路亽.° 提交于 2019-11-26 15:57:55
问题 Which of these is better or faster to use as the shebang line for a Perl script? #! perl #! perl.exe #! fullpath/perl(/perl.exe) #! partialpath/perl(/perl.exe) And, when using #!perl , when it works on a particular system, how do I find out in the script which perl interpreter I'm using so I can put that one into the shebang line? And, if using a /path/path/perl , are * or ... allowed to be used for the folders? 回答1: If you have to hard code #!, use #!/usr/bin/env perl . Why? What you want is

Why do you need to put #!/bin/bash at the beginning of a script file?

泪湿孤枕 提交于 2019-11-26 13:52:34
I have made Bash scripts before and they all ran fine without this at the beginning. What's the point of putting it in? Would things be any different? Also, how do you pronounce # ? I know that ! is pronounced as "bang." How is #! pronounced? paulsm4 It's a convention so the *nix shell knows what kind of interpreter to run. For example, older flavors of ATT defaulted to sh (the Bourne shell), while older versions of BSD defaulted to csh (the C shell). Even today (where most systems run bash, the "Bourne Again Shell" ), scripts can be in bash, python, perl, ruby, PHP, etc, etc. For example, you