I'm attempting to run some ruby script in a .txt file from the command line. If I use the ruby command before I run the command, the output is what was desired, e.g.
我试图从命令行在.txt文件中运行一些ruby脚本。如果我在运行命令之前使用ruby命令,则输出是所需的,例如
ruby file_name.txt 10 40
How could I execute the same command without having to use the ruby command?
如何在不使用ruby命令的情况下执行相同的命令?
1 个解决方案
#1
0
If you are on a unix, you put a #!/usr/bin/ruby
at the top of it and the bash
shell will execute it.
如果您使用的是unix,则在其顶部放置一个#!/ usr / bin / ruby,bash shell将执行它。
If you are on Windows, I believe you must use the correct suffix, .rb
or .rbw
.
如果您使用的是Windows,我相信您必须使用正确的后缀,.rb或.rbw。
#1
0
If you are on a unix, you put a #!/usr/bin/ruby
at the top of it and the bash
shell will execute it.
如果您使用的是unix,则在其顶部放置一个#!/ usr / bin / ruby,bash shell将执行它。
If you are on Windows, I believe you must use the correct suffix, .rb
or .rbw
.
如果您使用的是Windows,我相信您必须使用正确的后缀,.rb或.rbw。