Ruby语言:Ruby程序运行外部程序(一)
Posted by cnruby Thu, 24 Jan 2008 21:10:00 GMT
Ruby语言:Ruby程序运行外部程序(一)
(.^.)软件环境- Ruby 1.8.6
- 有用的Windows命令工具集GnuWin32
- Linux系统实例代码
system "rm /tmp/hello.txt" - Windows实例代码
system "cmd /c del ./hello.txt"
system "calc" - 说明
在执行该函数system以后,程序会继续执行之后的代码。
- Linux系统实例代码
system "ls -al /tmp/hello.txt" - Windows实例代码
system "ls -al ./hello.txt" - 说明
在执行该函数exec以后,程序就停止执行之后的代码。
- Windows和Linux系统实例代码
·ls -al .· - 说明
函数·(重音符,在Tab键上面的按钮)能够让我们获得输出结果。
- Windows和Linux系统实例代码
%x(ls -al .) - 说明
注意这里的括号不能省略。
________________________________________________________________ 您只要点击下面图标,就可以把本文加入到您喜欢的公共收藏库中去。



![Validate my RSS feed [Valid RSS]](/blog1/files/valid-rss.png)




