如何用ruby调用另一个ruby脚本?

Python016

如何用ruby调用另一个ruby脚本?,第1张

system(“.ruby”)或者load 'another.rb'

具体代码如下:

# 返回ls的输出

s=`ls`

cmd= "ls"

s= `#{cmd}`

# 返回true or false

s= system('ls')

cmd= 'ls'

s= system(cmd)

#返回输出

s= %x[uptime]

#用top进程替换当前ruby进程

exec "top"

cmd = 'top'

exec cmd

定时任务编辑是 crontab -e

不是crontable.

* * * * * cmd

分时日月周 命令

确保你的格式是对的,还有是用命令行去运行你的脚本