从文档
-0 位 =>
将输入记录分隔符 ($/) 指定为八进制数。如果没有给出数字,则空字符是分隔符。其他开关可能跟在数字后面。-00 将 Ruby 转换为段落模式。-0777 使 Ruby 将整个文件作为单个字符串一次读取,因为该值没有合法字符。
我的错!根本消化不了。所以让我们开始玩它。
C:\>ruby -0777 -e 'a= gets; puts a '
Hi, This is Ram.
Could you help me here?
^Z #~~~> pressed ENTER here after CTRL+Z and got the output as below-
Hi, This is Ram.
Could you help me here?
C:\>ruby #~~~> return the prompt
C:\>ruby -000 -e 'a= gets; puts a '
Hi, This is Ram.
Could you help me here?
^Z #~~~> pressed ENTER here after CTRL+Z and got the output as below-
Hi, This is Ram.
Could you help me here?
C:\>ruby #~~~> return the prompt
C:\>ruby -00 -e 'a= gets; puts a '
Hi, This is Ram.
Could you help me here? #~~~> pressed ENTER
#~~~> pressed ENTER here and got the output as below-
Hi, This is Ram.
Could you help me here?
C:\>ruby #~~~> return the prompt
问题:1 -我可以设置octal
如下$/
吗?
carraige return (\r)
tab (\t)
如果是这样,我可以为每个人举一个例子来看看他们的行为吗?
问题:2 - 我也尝试打印 的值,"$/"
但没有打印任何内容。那我应该怎么看呢?
C:\>ruby -00 -e 'a= gets; puts a ;puts "here is: #{$/}"'
hi
hi
here is:
C:\>ruby -0777 -e 'a= gets; puts a ;puts "here is: #{$/}"'
Hey! Arjun
Are you going school?
^Z
Hey! Arjun
Are you going school?
here is:
C:\>