Ruby/Language Basics/shebang line

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

Версия от 17:59, 13 сентября 2010; ViGOur (Обсуждение | вклад)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

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!"