简体   繁体   English

OSX 10.9.4 ruby​​ -version错误

[英]OSX 10.9.4 ruby -version error

不确定我的ruby安装会发生什么

$ ruby -version ruby 1.8.7 (2013-12-22 patchlevel 375) [i686-darwin13.3.0] -e:1: undefined local variable or method rsion' for main:Object (NameError)

You can string multiple parameters together when you run Ruby. 运行Ruby时,可以将多个参数串在一起。 In this case, -v is being interpreted as 'version' where as the 'e' is being interpreted as -e, which from the man page: 在这种情况下,-v被解释为'version',其中'e'被解释为-e,来自手册页:

Specifies script from command-line while telling Ruby not to search the rest of the arguments for a script file name. 从命令行指定脚本,同时告诉Ruby不要搜索脚本文件名的其余参数。

Ruby is then trying to parse the remainder ('rsion') as an argument to the -e. 然后Ruby尝试将剩余部分('rsion')解析为-e的参数。 What you want it either: 你想要的是:

ruby -v

or 要么

ruby --version

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM