Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ruby、unix和here文档_Ruby_Unix_Heredoc - Fatal编程技术网

ruby、unix和here文档

ruby、unix和here文档,ruby,unix,heredoc,Ruby,Unix,Heredoc,所以我想知道如何在ruby中处理这里的文档,例如,这是我程序中的主循环: begin word = gets if word.nil? next end command = word.chomp.to_s print word end until (word.eql? "EOI") 我通过执行/file来运行它,为什么不循环到word.nil?,如果用户发送EOF(Ctrl-d)也会这样 hello world EOI until (

所以我想知道如何在ruby中处理这里的文档,例如,这是我程序中的主循环:

begin
    word = gets
    if word.nil?
        next
    end
    command = word.chomp.to_s
    print word
end until (word.eql? "EOI")

我通过执行
/file来运行它,为什么不循环到
word.nil?
,如果用户发送
EOF
Ctrl-d
)也会这样

hello

world
EOI
until (word = gets).nil?
  print word.chomp
end