运行正确:
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 # [pressed ENTER]
> [pressed ENTER]
> hi #[pressed ENTER]
> ^C
@ubuntu:~$
有什么建议可以让它在 Ubuntu 中运行吗?