Ubuntu中的Ruby解释器问题

Ubuntu中的Ruby解释器问题,ruby,ubuntu,ruby-1.9.3,Ruby,Ubuntu,Ruby 1.9.3,系统运行正常: C:\>ruby -00 -e 'a= gets; puts a ;puts "here is: #{$/.inspect}"' Hi #[pressed ENTER] [pressed ENTER] Hi # <~~ here Hi came as the output, as expected. here is: "\n\n" #<~~ here Hi came as the output, as expected. C:\> 有什么建议可以让

系统运行正常:

C:\>ruby -00 -e 'a= gets; puts a ;puts "here is: #{$/.inspect}"'
Hi #[pressed ENTER]
[pressed ENTER]
Hi # <~~ here Hi came as the output, as expected.

here is: "\n\n"  #<~~ here Hi came as the output, as expected.

C:\>

有什么建议可以让它在Ubuntu中工作吗?

在Ubuntu中对我来说非常好:

% ruby -00 -e 'a = gets; puts a; puts "here is #{$/.inspect}"'                                                                        
hi

hi

here is "\n\n"

看起来您只是缺少命令中的最后一个引号。

ruby-015-e'a=get;提出了一个解决方案;放置“here is:#{$/.inspect}”
您能试试吗?在这种情况下,按enter键没有任何作用,因为它不会生成回车。但是,如果我使用
ctrl-v
ctrl-m
生成一个\r,它会起作用:
hello^m hello here is:“\r”
你能告诉我这个的来源吗?什么控制键用于什么?我还有很多东西要测试。我所做的只是在谷歌上搜索如何生成回车,发现它是
ctrl-v
ctrl-m
。试过了,成功了。好的。。。。。。。你能给我一个你发现
ctrl-m
的链接吗请,我正在寻找
backspace
没有得到正确的链接。我必须运行
ruby-010-e'a=get;提出了一个解决方案;放上“这是:{$/.inspect}”
% ruby -00 -e 'a = gets; puts a; puts "here is #{$/.inspect}"'                                                                        
hi

hi

here is "\n\n"