shebang

Python shebang line [duplicate]

不羁的心 提交于 2019-12-13 14:18:20
问题 This question already has answers here : Why do people write the #!/usr/bin/env python shebang on the first line of a Python script? (20 answers) Closed last year . i've seen some people write their shebang line with a space after env. Eg. #!/usr/bin/env python Is this a typo? I don't ever use a space. I use #!/usr/bin/env/python Can someone please clarify this? 回答1: No it isn't a typo! The one you are using will not work on all os's. E.G. in my Ubuntu Linux implementation 'env' is a program

Python script: problems with shebang line (unix)

白昼怎懂夜的黑 提交于 2019-12-12 01:43:15
问题 I am trying to get a feel for the Flask microframework by launching a test application to local server. When trying to run my code, app.py , I keep getting the error message: -bash: ./app.py: /flask/bin/python: bad interpreter: No such file or directory Here is the basic code (taken from here) for app.py , which lives in my todo-api directory: #!/flask/bin/python from flask import Flask app = Flask(__name__) @app.route('/') def index(): return "Hello, World!" if __name__ == '__main__': app

How does the shebang execute the program?

帅比萌擦擦* 提交于 2019-12-11 04:34:01
问题 I feel like a total noob asking this question, but I'm wondering, how does the shebang in a program ( Ex : #!/usr/bin/env python ) execute it? I know that the file is run by ./filename , but how does it run it with the right executor? Would it be the same as running it with the python command? If so, how does the shebang redirect it to the command? 回答1: Sergio Answered: The shebang line specifies the right "executor". That's how it is found (by the program loader). 来源: https://stackoverflow

How does Perl handle the shebang line?

夙愿已清 提交于 2019-12-11 03:23:45
问题 I'm trying to understand how perl deals with the shebang line. I used to think that any interpreter mentioned in the "command position" on the command line would take precedence over one mentioned in the shebang line. For example, if an executable script called demo looks like this #!/usr/local/bin/perl-5.00503 printf "$]\n"; ...then I would observe the following: $ ./demo 5.00503 % /usr/local/bin/perl-5.22 ./demo 5.022003 IOW, in the first execution, the interpreter in the shebang is the one

Is it possible to make a Java executable?

流过昼夜 提交于 2019-12-10 14:57:35
问题 To be clear, by executable I do not mean literal bytes ready for the processor. For example a bash script, which is interpreted and not executable, becomes executable when a shebang is added to the top that specifies the script should be run by /bin/bash or /bin/sh or whatever program will be interpreting it. I was wondering if it's possible to do with Java, which is not technically a scripting language but is definitely not executable. It seems like Java would be hard because the user doesn

What does the symbol “#!” mean in Python?

不问归期 提交于 2019-12-08 15:40:05
问题 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 回答1: It's not a Python thing, it a hashbang (or shebang) line which indicates which interpreter should process the file. The rules vary but, in its simplest form, a file with the name xyz (containing that as the first line), when run from the command line with xyz , will run it using that interpreter

Git: how to deal with different shebang

瘦欲@ 提交于 2019-12-08 15:27:12
问题 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 mine is /usr/local/bin/ruby. I manually edit the shebang, but then git marks it as a change. Ideally, I would like git to ignore the first line of the file, or perhaps to ignore a regex match of lines within the file. It seems to me this must be a very

For ruby/webrick, I need windows to recognize shebang (#!) notation

岁酱吖の 提交于 2019-12-08 01:56:41
问题 (Bear with me, I promise this gets to shebang and windows.) I have about the simplest of WEBRick servers put together: require 'webrick' include WEBrick s = HTTPServer.new(:Port=>2000, :DocumentRoot=>Dir::pwd) s.start Couldn't be simpler. This basic server does accept http connections (firefox, internet exploder, wget, TELENT) and deals with them appropriately, as long as I'm just fetching static documents. If, however, I set one of the files in the directory to have a .cgi extension, I get a

Passing Ruby interpreter arguments with hashbang command

陌路散爱 提交于 2019-12-08 01:52:35
问题 I am using the following hashbang command with my RVM installation. How do I pass the -w argument to the ruby interpreter? #!/usr/bin/env ruby Thanks. 回答1: I recommend setting the RUBYOPT environment variable. In this manner, you don't have to edit your executables. RUBYOPT="-w $RUBYOPT" 回答2: According to this reference you can use a separate declaration outside of the shebang for that: #! /usr/bin/env ruby $VERBOSE=true 来源: https://stackoverflow.com/questions/17460206/passing-ruby

Why won't my Ruby script execute?

[亡魂溺海] 提交于 2019-12-07 18:32:25
So, I made a simply ruby script, #!/usr/bin/env ruby puts "Hello!" When I try to run it in terminal it doesn't put "Hello!" on the screen. I have tried entering chmod +x test.rb ( test.rb is the name of my file). When I run it, it doesn't give me an error, it just doesn't display "Hello!". Any help will be much appreciated. I have looked everywhere for a possible answer, and I have found nothing so far. I'd guess that you're trying to run it as just test like this: $ test But test is a bash builtin command that doesn't produce any output, it just sets a return value. If you run your script