From: Robert Dober Date: 2007-03-07T20:52:15+09:00 Subject: Re: elseif v. elsif ?? On 3/7/07, 7stud 7stud wrote: > Another question. The tutorial says: > > >Save this file as "ri20min.rb", and run it as "ruby ri20min.rb". > > and at the top of the file is the shebang: > > #!/usr/bin/env ruby > > If you run the program using 'ruby filename', do you need the shebang? That is correct > I read something that said you only need the shebang if you want to > execute programs using just the filename, e.g.: > > $ HelloWorld.rb exactly > > also what does 'env' do? I read the man pages on the env function, and > I can't figure out what it does in the shebang. It runs a program in a modified environment, it is frequently used in the shebang because it is normally in a standard location while ruby itself might be in different locations e.g. /usr/bin or /usr/local/bin. It is a trick to get this information from the "environment". But is is not always a good idea, try #!/usr/bin/env ruby -w it does not work -w is interpreted by env not by ruby :( > > -- > Posted via http://www.ruby-forum.com/. > > Robert -- We have not succeeded in answering all of our questions. In fact, in some ways, we are more confused than ever. But we feel we are confused on a higher level and about more important things. -Anonymous