新手问题 [已解决] 在.rb 文件中执行 print 函数和 irb 中执行结果不同?

allenfantasy · December 09, 2013 · Last by allenfantasy replied at December 09, 2013 · 2641 hits

RT。情况如下:

# test.rb
print "gogogo"

在终端中执行 test.rb:

然后我在 irb 里面执行 print 函数:

执行 test.rb 输出的结果多了个百分号?囧 rz……

检查了文件编码,utf-8,除了一行 print 外没有多余代码;ruby 版本是 1.9.3-p448;google 了ruby print 得到的信息大多是 print 和 puts, p 的区别,找不到这个奇怪的现象。求解释……

Unknow user #1 December 09, 2013

PS1 好奇怪啊……

只是 zsh 的问题……

When a partial line is preserved, by  default  you  will
see  an inverse+bold character at the end of the partial
line:  a "%" for a normal user or a "#"  for  root.   If
set,  the shell parameter PROMPT_EOL_MARK can be used to
customize how the end of partial lines are shown.

#2 楼 @Kabie 原来是这样……谢谢哇~

You need to Sign in before reply, if you don't have an account, please Sign up first.