Ruby/Language Basics/shebang line

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск

avoid typing ruby each time on Unix/Linux systems by adding a shebang line (#!) at the top of your Ruby file.

#!/usr/local/bin/ruby
# a nice greeting for Tom
puts "Hello, Tom!"



Using a Shebang Line on Unix/Linux

# A shebang line may appear on the first line of a Ruby program (or other program or script). 
# It helps a Unix/Linux system execute the commands according to a specified interpreter?by. 
# This does not work on Windows.
 
#!/usr/bin/env ruby   
puts "Hello, Tom!"